I need to execute a command-line tool to force maximum display brightness before user logs in (so login screen is shown with maximum brightness)
My problem is, if I run it from LaunchDaemons
, it doesn't work. I think it is because from LaunchDaemons
you can't run anything that interacts with the Window Server.
If I run it from LaunchAgents
, it works. But it runs after login, so it is not an option.
Is there any alternative to LaunchDaemons
to run scripts or programs that allow WindowServer access?
Best Answer
PreLoginAgents
macOS supports the ability to run graphical applications pre-login:
The trick is to add the following lines to your /Library/LaunchAgents launchd plist:
The executable must be stored in
/Library/PrivilegedHelperTools
.We used this ability to show a notification window pre-login for Power Manager pending events.
This functionality may not be supported in the latest macOS; we have not relied on it for a long while.