Using terminal to have xflux at a certain temperature at all times

Solution 1:

xflux - because it's what you're asking for

xflux works this way and provides no option to change its behaviour, you give it your location and it will use this plus your system time to determine when it should change the color, based on sunrise and sunset at the chosen location. We certainly don't want to fiddle with the system time, but how about we just fake time (sudo apt install faketime)?

faketime 20 xflux -l 52.5, -g -1.886 -k 3200

will start xflux as if it's eight o'clock. faketime has a “freeze clock at absolute timestamp” feature, but unfortunately I didn't get it to work with xflux. I suggest you use the GNU coreutil timeout instead:

timeout -k0 8h faketime 20 xflux -l 52.5, -g -1.886 -k 3200 -nofork

This will start xflux as if it's eight o'clock and kill it instantly (0) after 8 hours. For timeout to work it's necessary to start xflux with the -nofork option. For xflux it's four in the morning then, so if you don't live anywhere where the sun rises earlier it should keep the specified color temperature over the whole runtime. Of course you might change the location and/or the faketime to a place and time that fits your exact needs. To automate the process set a cronjob with crontab -e like this:

0 */8 * * * DISPLAY=:0 timeout -k0 8h faketime 20 xflux -l 52.5, -g -1.886 -k 3200 -nofork

This will run the command once every eight hours. As timeout also kills it after eight hours this makes for a constant color temperature all day long – unfortunately with a quick flash every eight hours which I wasn't able to eliminate.

There is a tray icon GUI called fluxgui · Github available via this PPA.

redshift – because it offers a much easier solution to your problem

There are alternatives like redshift (sudo apt install redshift) which allow you to manually set the color temperature:

redshift -O 3200

This will stay in effect until you turn it off with redshift -x. The packageredshift-gtk (sudo apt install redshift-gtk) provides a tray icon which allows you to switch if off with a mouse click.

Solution 2:

Seconding the Redshift solution...but if you really want to stick with xflux, instead of tricking it with time you can trick it with location. Just choose a location opposite yours - one that is night-time while your actual location is day-time.