Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

rustyj110

macrumors newbie
Original poster
Feb 11, 2008
4
0
Hello,

I am trying to make a widget that has a function to restart the dock. The only way I know to do this is to use the command:

widget.system("killall Dock", null);

But when I execute the function the dock does not restart. In fact, the killall function does not work with any process. Is there a way to do this?

Thanks

Rusty
 

sord

macrumors 6502
Jun 16, 2004
352
0
I'm not familiar with writing widgets, but try /usr/bin/killall instead of just killall
 

rustyj110

macrumors newbie
Original poster
Feb 11, 2008
4
0
Another Problem

Ok, I have another problem.

Using the above command I was able to get the function to work on the widget when I ran it through Dashcode, however, when the widget is on the actual desktop it not longer works. I assume that it will not let me restart the Dock because Dashboard is part of the dock?

Is there any way to get around this?
 

sord

macrumors 6502
Jun 16, 2004
352
0
Not sure what the problem is, but when killing the dock I've always used 'kill -HUP <pid>'.

For example you could execute something like:
Code:
/bin/kill -HUP `/bin/ps -ax -o pid,command | /usr/bin/grep Dock | /usr/bin/grep CoreServices | /usr/bin/sed 's/^[ ]*\([0-9]*\).*/\1/'`
Might not solve your problem though... give it a try
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.