site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Thread-index: AcbsvLlr0vqyZeStR4GC8glaEYIsfAAAYneg Thread-topic: per user agents/login items Hello, thank you for your answer. For now I have found that LoginHook seem to be what I am looking for (http://developer.apple.com/documentation/MacOSX/Conceptual/BPSystemStartup/A...). A LoginHook executes a script as root, so my script simply uses su to run my executable as the logged in user. Since LoginHook works for 10.3 and up, this seems OK. As I execute under the current user session, I can use the CF locale calls. If anyone knows another way to start a per user executable on login (for 10.3 and 10.4), please let me know. thanks, Philip Lukidis
-----Original Message----- From: Stéphane Sudre [mailto:ssudre2@wanadoo.fr] Sent: Tuesday, October 10, 2006 6:33 PM To: Philip Lukidis Cc: darwin-dev@lists.apple.com Subject: Re: per user agents/login items
On mardi, octobre 10, 2006, at 11:02 PM, Philip Lukidis wrote:
Hello. I have a daemon which provides access to a certain device. However, the device needs to have text displayed on its LCD which fits the current locale. Unfortunately, I don't know of a way to query the current user's locale in a daemon (assuming there is a current user), as it runs under the root user. Any solution must work in 10.3 and 10.4...
Therefore, is there a way to: a) Let the daemon be notified of user logon, and query the locale of that user? b) Split user dependent functionality out of the daemon and run it as a per user item. However, the daemon would need to communicate with this item and get the locale, and I don't know how to create a per user startupitem. c) Could the daemon be notified of user login, and spawn a helper app in that user session which would return the locale?
1. When no user is logged in, you can probably assume that the system language is OK, you can find this information in the /var/log/CDIS.custom file.
2. You can be informed of user login/logout via the SystemConfiguration Framework. Just take in count that Fast User Switching can pretend there is a user logged in while it's only the login window being displayed.
3. You can spawn a helper app and communicate with your daemon using Message Ports, sockets, pipe, etc... I'm a big fan of CFMessagePort but YMMV.
4. If you use a helper app, you should probablynot look for the locale but use the CoreFoundation API to access localized strings.
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com