4

A coworker and I timeshare an iMac (with external displays). I use it during the day and have it relatively bright to compensate for the light coming in the window and whatnot. He uses it at night and so he wants it more dim. We use different OS X user accounts, but every time I log in after him, the brightness is set back to dim.

Is there a way to make the brightness a setting at the user level, rather than the system level, as it seems to be doing now?

  • Just to be clear, he's setting the brightness through the controls in OS X, not through any controls on the monitor itself, right? Are either of your accounts on the computer administrators? – tubedogg Aug 23 '16 at 16:56
  • 1
    Michael, I believe I've found the easiest solution to your problem, one that will take maybe two minutes to set up. Please let me know if it works!! – owlswipe Aug 25 '16 at 15:06
2
+50

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.

2

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?

  • so this isn't really fair to you, but apparently that package brightness doesn't yet support my hardware github.com/nriley/brightness/issues/10#issuecomment-241805384 do you happen to know it in such detail? – Michael Aug 23 '16 at 17:14
  • So, you have 5K iMac? – Allan Aug 23 '16 at 17:22
  • You may be able to do this via applescript. Have a look at this post and see if that apple script works for you. If it does, I will modify my answer to take into account for the 5K monitors. – Allan Aug 23 '16 at 17:28
  • ok, so i think i have it ready. just need to wait on co-worker to test. (I'm worried that the RunAtLoad may result in it only happening when i first launchctl load it, or only when i'm logging in. I don't logout when i leave, so my colleague just switches users. will this run when i'm just switching back? we shall see. thansk for your help. btw, it looks like KeepAlive resulted in this running every few seconds, so i dropped that. see gist.github.com/thegreatmichael/… gist.github.com/thegreatmichael/… – Michael Aug 25 '16 at 0:30
  • it seems that switching users is not sufficient to trigger this script /-: – Michael Aug 29 '16 at 12:45
0

If you use the calibration function (System Preferences > Display > Color tab > Calibrate) you can set the brightness through that function. Calibration profiles are per-user, so you can select your new one and the coworker can continue using whatever profile they're using now. It should restore your profile setting every time you login to your user account.

  • sorry it took me so long to check this. I tried what you suggested, but there doesn't seem to be a Brightness setting, even in Expert Mode – Michael Aug 21 '16 at 18:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .