On Thu May 21 2015 09:12:08 [email protected] said: > >> On May 20, 2015, at 3:14 PM, Carl Hoefs <[email protected]> >> wrote: >> >> From a bash script I launch an app, but I only want this behavior if the >> user is locally logged in at the console. If the user has ssh’d into the >> machine and is running the bash script, the app launch should not be >> attempted (it will fail since the user doesn’t ‘own’ the screen). > > What is the trigger event for your script? If it is login, then you can > just use the launch-agent part of launchd to make this distinction. The > `LimitLoadToSessionType` key take “Aqua” and “StandardIO” to differentiate > between GUI and non-GUI (e.g.: ssh) sessions. There are also “Background” > that apply to all types of logins, and "LoginWindow” that only runs in that > context.
Good points. One other thing to consider is that since the launch will fail when not on the console, you can simply trap the error and return “This script must be launched from a local login session” or similar. -- The facts, though interesting, are irrelevant. _______________________________________________ MacOSX-talk mailing list [email protected] http://www.omnigroup.com/mailman/listinfo/macosx-talk
