Solstice tip: Automatically run f.lux every day at 6 pm

screenshot of flux app

It's the first day of summer in the Northern Hemisphere, so it's a perfect time to note that sitting in front of a glowing blue light for hours on end isn't particularly natural for us humans.

f.lux is a Mac app which automatically adjusts the brightness and color of your computer display. The general non-technical idea behind the app is that the usual blue-white light from the screen tricks your brain into thinking that it is daylight, which suppresses the natural sleepiness response to the cycle of day/night. Are those claims scientifically valid? I have no idea, but a) there seems to be good science behind it, and b) I can tell you that when I run f.lux, I tend not to stay up as late, and if I turn f.lux off at night I am amazed how blindingly bright my Mac's screen is. The app is free, so if you use your Mac after sundown (and I bet you do!), why not give it at try?

The other day on Twitter, Greg Pfeil wrote: "Realizing I've been up late on the computer lately because I disabled @JustGetFlux a couple days ago and forgot to turn it back on." I had been using a Keyboard Maestro macro to launch f.lux every day, but decided that it would probably be better as a launchd trigger because I'm not sure what happens to Keyboard Maestro time-trigger macros if your Mac is asleep when they are supposed to run, whereas I'm 99% sure that launchd will "catch up" and still run the command when the computer wakes up. Plus launchd is something anyone can use, even if they don't have Keyboard Maestro (which you should, but that's beside the point).

To do this, first download f.lux and install it. Launch it and be sure to give it access to your location. Configure it if you like to tweak things, or just use the default settings (FWIW, that's what I use).

Next, download this gist:

and save as ~/Library/LaunchAgents/com.tjluoma.flux.plist and then either: 1) logout/login or 2) enter this in Terminal:

launchctl load "$HOME/Library/LaunchAgents/com.tjluoma.flux.plist" 

Voilà! Now you never have to worry about remembering to launch f.lux again! And if the app is already running, that command won't cause any problems. If you want to change the time when f.lux launches (for example, in the winter you might want it to launch at 4:00 p.m. instead of 6:00 p.m.) change the plist file <key>Hour</key> to something other than 18. As always, when editing launchd plists I recommend LaunchControl.