Dashcode: can't use "killall Dock"

Discussion in 'Mac Programming' started by rustyj110, Feb 16, 2008.

  1. rustyj110
    Expand Collapse
    macrumors newbie

    Joined:
    Feb 11, 2008
    #1
    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
     
  2. sord
    Expand Collapse
    macrumors 6502

    Joined:
    Jun 16, 2004
    #2
    I'm not familiar with writing widgets, but try /usr/bin/killall instead of just killall
     
  3. rustyj110
    Expand Collapse
    thread starter macrumors newbie

    Joined:
    Feb 11, 2008
    #3
    This works:

    widget.system("/usr/bin/killall Dock", null);
     
  4. rustyj110
    Expand Collapse
    thread starter macrumors newbie

    Joined:
    Feb 11, 2008
    #4
    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?
     
  5. sord
    Expand Collapse
    macrumors 6502

    Joined:
    Jun 16, 2004
    #5
    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
     

Share This Page