Accounts, and click on your account name. Y" />
开发者

Java invoke com.apple.loginitems

开发者 https://www.devze.com 2023-01-05 04:58 出处:网络
I\'m trying to add my Java Application to the \"Login Items\" preferences pane that appears in OSX. This pane is visible if you go to System Preferences --> Accounts, and click on your account name. Y

I'm trying to add my Java Application to the "Login Items" preferences pane that appears in OSX. This pane is visible if you go to System Preferences --> Accounts, and click on your account name. You should then see a "Login Items" of programs that will automatically open when you log in.

I know I can add my program using launchd, or LaunchServices, but I had a few users ask if it could display inside the "Login Items" window. In order to do this, I believe I need to modify com.apple.loginitems.plist, but the file is written in binary so it can't be readily accessed. I've looked at it using

defaults read com.apple.loginitems

and I've tried writing to it using

defaults write com.apple.loginitems key value

but it looks like the loginitems plist is quite complex and has a weird structure. I'm wondering开发者_JAVA技巧 if there's any proper way to do this using Java. I believe there used to be a Cocoa Java extension that let you do this, but I don't think that's possible anymore in Snow Leopard.

Hopefully someone can give me a hand here :-)


I actually just ended up writing a (very) short Cocoa console application in XCode using http://github.com/carpeaqua/Shared-File-List-Example/blob/master/Controller.m as an example

0

精彩评论

暂无评论...
验证码 换一张
取 消