Kilian / f.lux-indicator-applet

This repository is unmaintained. Visit:
https://github.com/xflux-gui/xflux-gui
Other
549 stars 105 forks source link

applet fails to launch silently #66

Open JCSzamosi opened 8 years ago

JCSzamosi commented 8 years ago

On Ubuntu 14.04. I've downloaded and installed the latest version (as of last week). It installed and I have xflux starting automatically, but the f.lux indicator applet won't launch (just fails silently from application launcher)

ntc2 commented 8 years ago

This comment includes a fix and a workaround for this issue, or a related issue.

Quick workaround

  1. Disable fluxgui by clicking on the fluxgui applet and choosing "quit" (doing killall fluxgui is not recommended because it will leave around a stale PID file which you'll need to remove with rm ~/.fluxgui.pid before restarting fluxgui).
  2. Unset your colortemp setting by running gconftool-2 --unset /apps/fluxgui/colortemp.
  3. Restart the fluxgui applet by running fluxgui &!.

Explanation of problem and a patch

Not sure if this is the same problem you were having, but for me the flux indicator applet was appearing in my system try, but flux was not dimming my screen, and when I clicked on it and choose "preferences" nothing would happen. Flux had been working previously for me, and I had set it to autostart.

I quit flux by clicking on the applet and choosing "quit", and then started flux in a terminal by typing fluxgui. The applet reappeared and when I clicked on it and chose "preferences" I saw an error in my terminal related to the

self.colsetting.set_active(self.temperature_to_key(self.settings.color))

call in /usr/share/pyshared/fluxgui/fluxapp.py having the wrong type of argument. After a little more poking around, I learned that the self.temperature_to_key(self.settings.color) call was returning None, apparently because the color setting stored in my gconf was somehow invalid (perhaps it became invalid after upgrading the fluxgui package; I saw some code related to upgrades and color settings). So, I edited temperature_to_key to return a default value (corresponding to 6500, which I think is full brightness):

$ diff -U15 /usr/share/pyshared/fluxgui/fluxapp.py.orig /usr/share/pyshared/fluxgui/fluxapp.py 
--- /usr/share/pyshared/fluxgui/fluxapp.py.orig 2016-02-20 22:57:35.084326694 -0800
+++ /usr/share/pyshared/fluxgui/fluxapp.py  2016-02-20 23:12:08.048309987 -0800
@@ -155,30 +155,32 @@

     temperatureKeys = {
                 0:  '2300',
                 1:  '2700',
                 2:  '3400',
                 3:  '4200',
                 4:  '5000',
                 5:  '6500',
                 "off": '6500',
     }

     def temperature_to_key(self, temperature):
         for i, t in self.temperatureKeys.items():
             if t == temperature:
                 return i
+        else:
+            return 5 # Must return an int

     def connect_widget(self, widget_name, connect_target=None,
[...]

After making the above change to /usr/share/pyshared/fluxgui/fluxapp.py the silent failure problem went away for me.

Another, simpler workaround, is probably to clear your gconf settings. You can see your current fluxgui settings using gconftool-2:

 $ gconftool-2  --recursive-list /apps/fluxgui                                                 
 longitude = -122.6223
 colortemp = 2300
 autostart = true
 zipcode = 97232
 latitude = 45.5148

You can clear your current colortemp setting with

$ gconftool-2  --unset /apps/fluxgui/colortemp

but you probably want to turn off fluxgui before doing this.

Flux version

I'm using fluxgui version 1.1.8-4~wily from https://launchpad.net/~nathan-renniewaldock/+archive/ubuntu/flux on Ubuntu 15.10.