5

I'm trying to configure my xflux to have the screen's temperature at 3200 at all times, however it only seems to configure it for night time.

Here's the command I put in: ./xflux -l 52.5, -g -1.886 -k 3200

This only configures it for night-time, is there any way to have this all the time?

4 Answers 4

5

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.

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.

2
  • 1
    Welcome to Ask Ubuntu! I recommend to edit this answer to expand it with specific details about how to do this. (See also How do I write a good answer? for general advice about what sorts of answers are considered most valuable on Ask Ubuntu.) Jan 5, 2018 at 15:08
  • This doesn't answer the question, which is about how to do it at all times, not just opposite times. Jan 6, 2018 at 1:23
1

Instead of forcefully applying a misfitting tool, use sct. As in sct 3200 (available since May 2016)

 Description: Set screen color temperature 
  sct is a small C program to change the screen color temperature. It 
  can be used to reduce or increase the amount of blue light produced 
  by the screen. 
  . 
  sct sets the color temperature of the screen via xrandr like redshift. 
  Unlike redshift, it is only 80 lines of C and will not change the 
  screen temperature automatically. 

https://github.com/Tookmund/setcolortemperature

0

Skip the middle men, go straight to the source.

I use:

xrandr --output HDMI2 --gamma 1.00000000:0.88267187:0.76921169 --brightness 0.8

Instead of trying to fake time or location, or installing more apps, I think this is a much more straightforward solution.


Redshift and xfluxh interferred with my custom brightness settings and kept setting it to 0.9! So I had to dump them. I then wrote a small PyQt script (system tray icon with my presets menu etc) that uses xrandr, and I'm happy since.

While writing this answer to fully explain it I realised there was already a detailed one written, which includes possible rgb triplets and brightness settings:

How to use "xrandr --gamma" for Gnome "Night Light"-like usage?

PS finding your display name:

xrandr --listactivemonitors

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .