User-specific display brightness settings

You can easily accomplish user-based brightness setting with the app EasyOnTheEyes, which is free and gets 5 stars on the Mac App Store.

Here's what you'll need to do:

  1. Download the app.
  2. Launch it on your account (the account that should have higher brightness) and choose Off on the menubar. This way, it won't dim when you are signed in to your account.
  3. Sign into your coworker's account, make sure EasyOnTheEyes is installed and running in the menubar on his account (you might need to install it again for him depending on your settings).
  4. In System Preferences, choose Users and Groups and then the Login Items section. You'll need to add EasyOnTheEyes as a login item for his account, so it can dim automatically when he logs in.
  5. Make sure his account is highlighted in the left pane (i.e. you're making the changes for his account, not your own). Then hit the + button below the Login Items table view, find EasyOnTheEyes in the Applications folder, and double-click it to add it to the Login Items list.
  6. Now, EasyOnTheEyes should show up in the These items will open automatically when you log in list. Note: You'll probably want to make the Hide checkbox checked, so your coworker isn't distracted by the bouncing app icon every time he logs in, but it's up to him.
  7. In the menubar, choose preset 1 and drag the slider to however your coworker will like the brightness.

That's it. Your coworker will have an automatically dimmed screen whenever he logs into his account, but you won't.


The way you can accomplish this

  • Brightness control program (can be installed via Homebrew or compiled from source)
  • A per user bash script that set's the brightness
  • Script Added to ~/Library/LaunchAgents and loaded with launchd

OR

There is an AppleScript method that you can use instead of using the brightness program reference above. I am not a fan of this method because I have not found AppleScript to be as reliable as bash (things break when Apple does updates). Scroll to the bottom for details.

Install Brightness

If you have Homebrew, issue the command brew install brightness. If compliling from source, download from the link provided then compile.

cd /brightness   ---- (or whereever you downloaded the source)
make
sudo make install

Test it out by issuing some brighness commands:

brightness 1    <------- set to 100%
brightness .5   <------- set to 50%


Write a bash script to be executed when you log in

#!/bin/bash

/<path-to-brightness>/brightness .75
sleep 20           # I put this here because I find lauchd needs some "time"
exit 0

Do this for each user and place the script in an easily accessed location. For example, create a "scripts" directory in each user's home directory:

/Users/<username>/Scripts/set_brightness.sh

This is just an example, you can place the script anywhere you like, but remember, you need one that is executable by each user. Speaking of "executable" make sure you set the permissions of the script to execute - chmod +x set_brightness.sh

Be sure to test out by executing the script directly from the command line by calling it:

$ ./set_brightness.sh

Your screen brightness should change to the setting in the script(make sure you change the setting manually first to make sure you are not changing it to what it already is).


Create a .plist file and Load to launchd

Your .plist will execute every time you log in, so it must be located in the ~/Library/LaunchAgents directory. As for the filename, my preference is to use something like the following:

com.user.setbrightness.plist


The .plist should look something like this:

 <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
     <key>Label</key>
     <string>com.user.brightness</string>
     <key>KeepAlive</key>
     <key>RunAtLoad</key>
     <true/>
     <key>Program</key>
     <string>/Users/<username>/<location of script>/set_brightness.sh
     </dict>
    </plist>

Load the .plist to launchd

launchctl load com.user.brightness.plist

Do this for each user so that every time the user logs in it will execute the bash script setting the brightness automatically.


Alternative Method (for 5K monitors)1

You can also do this via AppleScript and skip the brightness program altogether (I tested this on a non-5K iMac running 10.11.6 and it works).

AppleScript Code:

tell application "System Preferences"
    activate
    reveal anchor "displaysDisplayTab" of pane id "com.apple.preference.displays"
    tell application "System Events"
        delay 1
        set value of slider 1 of group 1 of tab group 1 of window 1 of process "System Preferences" to 0.5

    end tell
    quit
end tell

Save this AppleScript in the same way as described above.


Make this change to your .plist (relacing Program with ProgramArguments):

<key>ProgramArguments</key>
<array>
    <string>osascript</string>
    <string>path-to-script/set_brightness.scpt</string
</array>


1 Adapted from this post: Is it possible for an Applescript to dim/up 0%/100% screen brightness on OSX 10.9 Mavericks when connected to external display?