F.lux for Ubuntu
F.lux is a small but very useful application: It fades your screens to a warmer color temperature in the evening. This is pleasant for your eyes and won’t leave you wide awake at 2am because your computer monitors are so bright. There are mac and windows versions, but only a commandline app for Linux. Together with Michael Herf, the author of F.lux, I made a version for Ubuntu.
F.lux for Ubuntu is an indicator applet (like the new Messaging Menu), so it works very nicely on Ubuntu 10.04 and 10.10. Michael improved the commandline application by leaps and bounds. There are a bunch of new configuration options (all available in the GUI), the night/daytime cycle is now much more accurate, and it even takes daylight savings into account.
The F.lux indicator applet automatically manages the color temperature of your screen based on your latitude and longitude, or if you are in the US, your zipcode. In the preferences panel, you can set your preferred nighttime colortemperature and see a preview, as well as seeing the current color temperature.

Installation
Installation is easily done by adding the PPA for f.lux, simply type the following into your terminal:
sudo add-apt-repository ppa:kilian/f.luxsudo apt-get updatesudo apt-get install fluxgui
When you first launch the application (via ‘accessories’ in the menu, or by pressing alt+f2 and opening “fluxgui”) you will be asked to fill in either your latitude and langitude, or your zipcode. If you want f.lux to autostart at the next startup, select the “autostart” option. Close the preferences panel and you’re all set!
There is a bug in the current version of Fluxgui that’s preventing it from running correctly the first time it’s started. I wrote a fix that’ll be available in the PPA shortly (version 1.1.4). If you can’t start because fluxgui claims it’s already running, remove “fluxgui.pid” from the /tmp folder. After the update, it should work as advertised!
On developing F.lux for Ubuntu
As I mentioned, F.lux for Ubuntu is built using GTK+. This isn’t by choice, but needed because I wanted to built an indicator applet.
Coming from Python + Qt (for Trimage) , GTK+ feels like a serious step back. The Glade interface builder is clunky and quirky, and surprisingly, modules such as python-gconf and python-appindicator are virtually undocumented. There is a massive amount of time spent on figuring out what-goes-where-and-how.
Nevertheless, I like Python more each time I use it, and going back to JavaScript often feels weird (“Oh, yes, parentheses!”) so I think it’s time to start doing more with Coffeescript in the future.
Official announcement
Michael posted an official announcement on the F.lux website with these instructions as well: f.lux for linux, so be sure to go there and leave nice comments for us and tell us what we can improve! :)
Future versions
The currently released version is 1.1.1, For version 1.2 we will be adding a “pause for an hour” function, as well as an indication of how long until sunset/sunrise. Feel free to suggest other new features or fork the project on Github. It’s build using Python and GTK+, and the GUI is MIT licenced.
I’m quite proud of the result so far, and I hope it’ll be as useful to others as it already has been to me! Please leave suggestions for new features in the replies :)
25 comments
When I try to start fluxgui, It states: “fluxgui is already running, exiting”, and does not start. I am running Ubuntu 10.04, with awn (with support for app indicators) instead of the gnome panel.
hrm I get the following without anything else happening: fluxgui
/usr/lib/pymodules/python2.6/fluxgui/fluxgui.py:133: GtkWarning: Cannot transform xsetting Net/IconThemeName of type gchararray to type GdkColor
‘gtk-icon-theme-name’)
/usr/lib/pymodules/python2.6/fluxgui/fluxgui.py:133: Warning: g_value_unset: assertion `G_IS_VALUE (value)’ failed
‘gtk-icon-theme-name’)
/usr/lib/pymodules/python2.6/fluxgui/fluxgui.py:133: GtkWarning: Cannot transform xsetting Net/IconThemeName of type gchararray to type gint
‘gtk-icon-theme-name’)
Traceback (most recent call last):
File “/usr/lib/pymodules/python2.6/fluxgui/fluxgui.py”, line 352, in
app = Fluxgui()
File “/usr/lib/pymodules/python2.6/fluxgui/fluxgui.py”, line 21, in __init__
self.open_preferences(“activate”)
File “/usr/lib/pymodules/python2.6/fluxgui/fluxgui.py”, line 73, in open_preferences
self.get_colortemp()
File “/usr/lib/pymodules/python2.6/fluxgui/fluxgui.py”, line 64, in get_colortemp
self.xflux.sendline(“c”)
AttributeError: Fluxgui instance has no attribute ‘xflux’
Beautiful utility :)
Hey, I already have f.lux installed manually. What do I need to do to use it from the ppa?
Sameer and ‘someone’, There is an upcoming update on the PPA that fixes both these issues!
Olivia, If you add the ppa like the instructions, and autostart ‘fluxgui’ instead of ‘xflux’, you’re all set :)
I’ve been running f.lux on my XP netbook for a few weeks now and really like it. I don’t know if it makes a difference in my sleeping, but since I often use my machine late at night, it can’t hurt.
Now I can install it on my Ubuntu machines, too. Thanks!
Don’t forget about Redshift (http://jonls.dk/redshift/) which provides similar functionality for Linux.
I’ve been using it on my Mac for a while and it’s pretty nice. However, I have one bug report and one feature request. Bug: I’ve noticed the “Start Flux at Login” doesn’t seem to work – whenever I reboot I need to restart flux manually, it doesn’t start up by itself. Feature request: have the ability to disable Flux not just for an hour, but also while some app is in fullscreen mode. I’m not sure if this is even possible, but it would be nice to have Flux disabled while I’m watching a movie in the evening so the colors look normal.
[...] Kilian Valkhof s’est donc raproche de Michael Herf, l’auteur de F.lux afin de développer une version pour Ubuntu Lucid Lynx et Maverick Meerkat [...]
Nice work, however, it doesn’t work with a dual screen layout.
Sounds nice, I’d like to join in the fun, but I can’t.
I get the same error as has been pointed here :
AttributeError: Fluxgui instance has no attribute ‘xflux’
Long version :
Traceback (most recent call last):
File “/usr/lib/pymodules/python2.6/fluxgui/fluxgui.py”, line 352, in
app = Fluxgui()
File “/usr/lib/pymodules/python2.6/fluxgui/fluxgui.py”, line 21, in __init__
self.open_preferences(“activate”)
File “/usr/lib/pymodules/python2.6/fluxgui/fluxgui.py”, line 73, in open_preferences
self.get_colortemp()
File “/usr/lib/pymodules/python2.6/fluxgui/fluxgui.py”, line 64, in get_colortemp
self.xflux.sendline(“c”)
AttributeError: Fluxgui instance has no attribute ‘xflux’Traceback (most recent call last):
File “/usr/lib/pymodules/python2.6/fluxgui/fluxgui.py”, line 352, in
app = Fluxgui()
File “/usr/lib/pymodules/python2.6/fluxgui/fluxgui.py”, line 21, in __init__
self.open_preferences(“activate”)
File “/usr/lib/pymodules/python2.6/fluxgui/fluxgui.py”, line 73, in open_preferences
self.get_colortemp()
File “/usr/lib/pymodules/python2.6/fluxgui/fluxgui.py”, line 64, in get_colortemp
self.xflux.sendline(“c”)
AttributeError: Fluxgui instance has no attribute ‘xflux’
Worked on a dualscreen (nvidia twinview), but while fading, was using 100% of a cpu.
doeesn’t work for kddde
The latest version still has the “fluxgui is already running, exiting” problem. I fixed it by setting the following script to autostart:
#!/bin/sh
pkill fluxgui
pkill -9 fluxgui
rm -f /tmp/fluxgui.pid
fluxgui &
As a nocturnal coder, this program has saved me from several headaches. Great idea and thanks for sharing!
[...] are currently only instructions for installing on Ubuntu on the programer’s official post f.lux GUI for Linux, which includes installation instructions. These instructions consist of three quick commands: sudo [...]
[...] are currently only instructions for installing on Ubuntu on the programer’s official post f.lux GUI for Linux, which includes installation instructions. These instructions consist of three quick commands: sudo [...]
Excellent, but when do you plan on releasing a karmic package?
[...] dell’ora via NTP permette di ottenere sempre la luminosità più adeguata. Le istruzioni per l’installazione di F.Lux su Ubuntu (e sulle altre distribuzioni) si trovano sul blog di Kilian Valkhof, che ha [...]
GUI doesn’t seem to work too well. Have it on a Windows box too so I have something to compare it to. Typing now at almost 1 AM with both the Lat/Long and the zip code calibrated, set to “Tungsten”, but the color temperature is still listed as 6500K. Preview buttons work only intermittently … because of this, I’m probably switching to Redshift and seeing if their Linux integration is better
P.S. Using Ubuntu 10.04
why you can’t use the webcam to capture the light?
Some days are rainy/Cloudy or you just have the curtains down ,some kind of graphic scaled meter where user can set the tungsten level had been great for those days.Dont get me wrong the program looks and is great thx for that!
/Fab
When opening the GUI the preview button only works once. To get it to work again you have to close and reopen.
Also, the selected color temperature never seems to be reached. 2 AM right now and the listed color temperature is 44% over what I have selected. ???
Also the screen sometimes goes wacky when opening the GUI. This program doesn’t feel polished at all and doesn’t seem to work how it’s intended.
[...] with the blessing of XFlux’s creator Michael Herf, a new indicator applet for setting, controlling and, indeed, configuring XFlux has been developed by OMG! iRC! regular, [...]
Your response?
If you post code examples, make sure to escape your HTML.