Re: Automatically launch GUI app for current and future users
On Feb 8, 2012, at 4:11 AM, Per Olofsson wrote:
I have written a status menu application that we're going to deploy internally, pushed with Munki as a silent background install. It needs to launch automatically for all users, both when new users log in, and for those who are already logged in - I'd rather not force a logout to activate it. For new logins, any recommendations regarding a login item vs a launch agent?
• Global Login Item, $3/Library/Preferences/loginwindow.plist AutoLaunchedApplicationDictionary - Needs a defaults write -array-add, but if the installer is run again I assume there will be multiple entries. Solvable with FoundationPlist.py, but that's a little more work. + Visible to users under Users & Groups as a login item.
• LaunchAgent + Easy to write and deploy, just a plain file. - No obvious way for users to see or disable it, should they want to.
I prefer LaunchAgent; but there may be reasons to use a global login item instead, especially if you are supporting older OSes, as LaunchAgents for GUI apps didn't really work properly in Tiger. I think they are fine from Leopard onward, though.
Then for the challenge of launching the app for users that are currently logged in. I assume that this needs to be done with launchctl bsexec, but how do I produce a list of currently logged in users, and find a suitable PID for each?
who | grep console is a quick-and-dirty way to get current GUI users. Good luck with the rest!
-- Per Olofsson System Administrator, IT-services, University of Gothenburg
_______________________________________________ Do not post admin requests to the list. They will be ignored. Installer-dev mailing list (Installer-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/installer-dev/greg.neagle%40disneyan...
This email sent to greg.neagle@disneyanimation.com
_______________________________________________ Do not post admin requests to the list. They will be ignored. Installer-dev mailing list (Installer-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/installer-dev/site_archiver%40lists.... This email sent to site_archiver@lists.apple.com
participants (1)
-
Greg Neagle