Запустите приложение в окне входа

2557
unknowndomain

Я ищу способ запуска приложения, такого как Reflector или AirServer, как на Mac, так и на ПК до того, как произойдет вход пользователя в систему. Приложение практически не имеет графического интерфейса, пока кто-то не начнет отправлять на него данные, после чего оно переходит в полноэкранный режим.

Есть ли способ запустить приложение на экране входа в систему на Mac и / или ПК?

1

1 ответ на вопрос

0
user495470

In OS X you can create a pre-login launchd agent. For example save this property list as /Library/LaunchAgents/some.label.plist:

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>some.label</string> <key>LimitLoadToSessionType</key> <array> <string>LoginWindow</string> <string>Aqua</string> </array> <key>ProgramArguments</key> <array> <string>say</string> <string>a</string> </array> <key>RunAtLoad</key> <true/> </dict> </plist> 

Make sure the plist is owned by root. If it is not, it can be loaded if you run launchd load as the user but it is not loaded by launchd automatically.

Then if you restart, the say command should be run once when the login window is shown and again after a user logs in graphically.

If you don't want the program to be run again when a user logs in graphically, remove <string>Aqua</string>.

If automatic login is enabled and LimitLoadToSessionType is set to just LoginWindow, the program is not run at all.

See the Daemons and Agents tech note or man launchd.plist for more information.

Похожие вопросы