Thanks Quinn,

What i wanted to do - is to have an application similarly to finder remain in Dock (this is a parental control app that has to have an icon in Dock showing the  status of the daemon in that icon) without user being able to Quit it from the dock Menu (when one command-clicks on this icon with the mouse).

I described this issue here: http://stackoverflow.com/questions/6330518/how-to-make-a-finder-like-dock-menu

I desperately was looking for ways, how did Apple eliminate that "Quit" (and "Options") item from the Finder's Dock menu (it seems to me it is either hardcoded or hidden deep in plists, in either way not documented). That's why i'm searching for workarounds like - an agent without "LSUIItem" set to true - but, as i described earlier, the computer simply didn't shut down. To solve this issue, as Jerry suggested, I delegated this "dock icon" to a special "Docklet" application that only displays an icon in dock when its launched, and the Agent was to restart this "Docklet": if a user quits this Dock application, the supporting agent restarts this "Docklet" application automatically. And again, it failed - the shutdown is being cancelled by this "Dock app" this time. 

I am aware of that this is not a "mac way" to display status in Dock rather than a status bar, but I can't help it as the boss does not like little icon in status bar that my agent displays currently. And since Finder works like that I was hoping an another application can.

2011/6/14 Quinn "The Eskimo!" <eskimo1@apple.com>

On 10 Jun 2011, at 01:54, Nick wrote:

> But what differs an application from a command line application? How launchd realizes it's an application?

It's not launchd that realises that it's an app, it's loginwindow.  When you attempt to log out (which the initial step in restart and shutdown), loginwindow asks each of the app's to quit cleanly.  If an app can't quit, loginwindow prevents the log out.  You need to get your app out of that path, and the best way to do that is to prevent loginwindow from seeing your agent as a GUI app.

S+E
--
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware


_______________________________________________
launchd-dev mailing list
launchd-dev@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/launchd-dev