Kilian Valkhof

Front-end & user experience developer, Jedi.

F.lux for Ubuntu

Apps, Linux, 26 July 2010

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.

Screenshot of the preference panel

Installation

Installation is easily done by adding the PPA for f.lux, simply type the following into your terminal:

  1. sudo add-apt-repository ppa:kilian/f.lux
  2. sudo apt-get update
  3. sudo 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 :)

Thanks for Reading!

I am Kilian Valkhof, a front-end and user experience developer from the Netherlands.
Contact me or ping me on twitter.

  1. Andrew

    This is great! Id like to see the functionality of the Windows client. Specifically the setting to tell f.lux how long it should take to apply the screen adjustments. i like to set mine to change over an hour.

    Thanks!

  2. john smith

    Hey, running on linux and I thought you should know the description says “Better lightning for your computer” instead of “better lightening”. Not sure if it was a joke or a typo, but thought I’d let you know.

  3. Chris

    Is there any way to make this work on Debian?

  4. Rcg

    I have ubuntu 10.10, It works great. Thanks for helping and saving my eye sight.

  5. Cassandra

    Hi there. I love the applet but it does not actually switch the monitor color temp over at night on my ubuntu machine like flux does on my mac. The applet is running but the only way to get the color temp I need is to manually press the preview button every evening. Any chance of this being fixed? :(

  6. I’m having some trouble downloading the program, it appears that a directory doesn’t exist.. I can successfully add the repository, but when I update it ends with the following error: “W: Failed to fetch http://ppa.launchpad.net/kilian/f.lux/ubuntu/dists/oneiric/main/binary-i386/Packages 404 Not Found”

    Sure enough, when I go to that directory in my browser it doesn’t exist. I have to go back up to the /dists directory where the only folders are lucid, maverick, and natty. Any ETA on getting the 11.10 Oneiric directory up?

    In the meantime, you can download the .deb from here: http://ppa.launchpad.net/kilian/f.lux/ubuntu/pool/main/f/fluxgui/fluxgui_1.1.8_all.deb

  7. Jos

    Hey, this doesn’t work very well on Linux Mint 11. It doesn’t automatically fix the lighting; I have to clikc the “preview button” for it to work.

  8. Pat Suwalski

    The deb itself works fine on Ubuntu 11.10.

    However, with two screens, only the left one changes colour, making it less useful than it should be.

  9. Paul C.

    I have recently switched to Kubuntu from Ubuntu Oneiric, and I hope development is in the works to get f.lux working on our platform. This is a really great program, thank you, Kilian and Michael.

  10. Muhib

    I have installed the version by following your instructions. But when it’s night, nothing happens. I have this in my windows, it works nicely, but in ubuntu 10.04, I am having problem.
    The indicator applet shows, but when I run it or click the Preview button, nothing happens. Again, it’s also not working, it’s just showing the icon. Because when it’s night, nothing changes. Please reply me.

  11. Khannie

    For those of you having the “ValueError: could not find setting” problem as I was on ubuntu 11.04, the solution is this:

    download the source from git: https://github.com/Kilian/f.lux-indicator-applet/zipball/master

    unzip it

    replace the file /usr/lib/pymodules/python2.7/fluxgui/fluxgui.py with the one from the zip file: src/fluxgui/fluxgui.py

    (you will need to use sudo to overwrite the installed file)

    Works a treat after that (at least it did for me with the December 2011 sources from Git).

  12. locoyokel

    Seems to be working okay in ubuntu 10.4 Great program. Thanks.

  13. Vitalii

    Thanks for a nice program

  14. Jack Vermicelli

    It seems like f.lux only updates my screen’s color temp when I open the gui and click “preview”- it never changes on its own. How can I fix this?

  15. David Wilbard

    I’m having the same problem as Jack Vermicelli. I can get the color to change manually by opening the gui and clicking “preview” (though sometimes this requires me to close it and restart). But the color never changes on its own. Any way to fix?

  16. Rayne

    Really nice application, i work with the computer all day and this really makes it much easier on my eyes. I have it installed on my linux machine and my windows machine, the program works flawlessly on both platforms.

  17. BooVeMan

    Same as Jack and David…
    I’m on ubuntu12.04. I thought it was due to number errors (comma vs dot) but even with full numbers – no dice…

  18. Guest

    Is this open source?
    Is f.lux open source?

  19. Kyle

    I’ve been toying with it for a bit, and I managed to screw up my installation about 2 times. I’m running fluxgui on Ubuntu 12.04 and can’t seem to get it to work for Unity. I did, however, manage to do this: http://i.imgur.com/HZJ6K.png

    It happened after I installed and attempted to quit fluxgui and relaunch. I quit and the icon was still in the top right. I deleted the fluxgui.pid and relaunched at last, but then had two icons in the top right. Not sure why this is or how it happened.

  20. Temes Vörös

    If the indicator applet doesn’t do the work for you, you should run the app from the command line only: xflux -l latitude -g longitude -k temperature (eg. 2700) [-nofork if you want it to run in the foreground]. Note that if you run the app from the command line, launching the indicator applet will give you a seizure since the screen starts flashing frantically.

  21. didi

    I installed it on Kubuntu LTS 10.04 and I do get the option in the menu, and when I try to run the program, I do get the jumping cursor with the f.lux symbol, than I get the button in the task-bar that normally indicate a window on the desktop and than both disappear. Without starting the program.
    I tried what mentioned above by Temes Vörös, I did manage to start it (but without the option for a gradual change of temperature), the only problem is, that every time I restart the machine even the location disappear.

  22. Mike G.

    There is zero color change on my XP machine. I’ve tried multiple ways of viewing the color change in case I just haven’t noticed it, including checking “disable” while at nighttime. How do I fix this?

  23. Enrico Goosen

    Thanks Temes for the info on running F.lux via command line.
    It works, but only changes brightness on my primary monitor.
    How can I get it to change brightness on my secondary monitor as well?

  24. Ben

    In OSX you can get Flux to work on your secondary monitor by going to Display preferences and on your secondary monitor selecting the ‘Color LCD’ Display Profile. http://imgur.com/X5ONg

  25. Jon

    I just received this error starting fluxgui in kubuntu 12.04.

    fluxgui
    Traceback (most recent call last):
    File “/usr/lib/pymodules/python2.7/fluxgui/fluxgui.py”, line 381, in
    app = Fluxgui()
    File “/usr/lib/pymodules/python2.7/fluxgui/fluxgui.py”, line 17, in __init__
    self.indicator = Indicator(self)
    File “/usr/lib/pymodules/python2.7/fluxgui/fluxgui.py”, line 149, in __init__
    self.setup_indicator()
    File “/usr/lib/pymodules/python2.7/fluxgui/fluxgui.py”, line 162, in setup_indicator
    ‘gtk-icon-theme-name’)

    I solved this by going into fluxgui.py on line 160 and forcing the if condition to be false.

    if False and gtk.gdk.screen_get_default():

    It is not necessary to set an ubuntu icon, the normal fluxgui icon works fine. I don’t know why get_setting() was failing.

  26. […] indicator project was done by Kilian Valkhof (creator of trimage), and he’s posted the indicator applet source here on github. The new […]

  27. Andrew

    Ubuntu 12.10 (quantal) support plz!

  28. Ryan

    /usr/lib/pymodules/python2.6/fluxgui/fluxgui.py:162: GtkWarning: Cannot transform xsetting Net/IconThemeName of type gchararray to type GdkColor

    ‘gtk-icon-theme-name’)
    /usr/lib/pymodules/python2.6/fluxgui/fluxgui.py:162: Warning: g_value_unset: assertion `G_IS_VALUE (value)’ failed
    ‘gtk-icon-theme-name’)
    /usr/lib/pymodules/python2.6/fluxgui/fluxgui.py:162: GtkWarning: Cannot transform xsetting Net/IconThemeName of type gchararray to type gint

    ‘gtk-icon-theme-name’)
    ^CTraceback (most recent call last):
    File “/usr/bin/fluxgui”, line 23, in
    subprocess.call([sys.executable, path] + sys.argv[1:])
    File “/usr/lib/python2.6/subprocess.py”, line 480, in call
    return Popen(*popenargs, **kwargs).wait()
    File “/usr/lib/python2.6/subprocess.py”, line 1170, in wait
    pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
    File “/usr/lib/python2.6/subprocess.py”, line 465, in _eintr_retry_call
    return func(*args)

    Anyone have a fix for this? Clean install from repo: program doesn’t run. Seems like a critical bug to me…

  29. DaVince

    It worked the first time I used this, but afterwards, it just stopped working. Always says “fluxgui is already running, exiting”, even though it clearly isn’t.

  30. Loredana

    I get the same error as many here above:

    /usr/lib/pymodules/python2.7/fluxgui/fluxgui.py:162: GtkWarning: Cannot transform xsetting Net/IconThemeName of type gchararray to type GdkColor

    ‘gtk-icon-theme-name’)
    /usr/lib/pymodules/python2.7/fluxgui/fluxgui.py:162: Warning: g_value_unset: assertion `G_IS_VALUE (value)’ failed
    ‘gtk-icon-theme-name’)
    /usr/lib/pymodules/python2.7/fluxgui/fluxgui.py:162: GtkWarning: Cannot transform xsetting Net/IconThemeName of type gchararray to type gint

    ‘gtk-icon-theme-name’)

    and then when closing:
    ^CTraceback (most recent call last):
    File “/usr/bin/fluxgui”, line 23, in
    subprocess.call([sys.executable, path] + sys.argv[1:])
    File “/usr/lib/python2.7/subprocess.py”, line 493, in call
    return Popen(*popenargs, **kwargs).wait()
    File “/usr/lib/python2.7/subprocess.py”, line 1301, in wait
    pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
    File “/usr/lib/python2.7/subprocess.py”, line 478, in _eintr_retry_call
    return func(*args)
    KeyboardInterrupt

    Can somebody please help me?
    Thanks

  31. […] […]

  32. George

    I’m on Linux Mint 14 64bit and was hitting the problem where Flux was basically unresponsive after initial load – “Preferences” wouldn’t open, etc.

    Installing packages ia32-libs and libc6:i386 (both for running 32bit programs on 64bit machines) fixed this issue and Flux is happily running.

  33. JP

    George, thanks for the help! Finally I got this working on 64-bit.