PDA

View Full Version : Dashcode: can't use "killall Dock"




rustyj110
Feb 16, 2008, 05:10 PM
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
Feb 16, 2008, 05:35 PM
I'm not familiar with writing widgets, but try /usr/bin/killall instead of just killall

rustyj110
Feb 16, 2008, 05:36 PM
This works:

widget.system("/usr/bin/killall Dock", null);

rustyj110
Feb 17, 2008, 11:31 AM
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
Feb 17, 2008, 12:22 PM
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:
/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