0

redshift is a package that enables blue light filter, so people can avoid eye strain.

This software is pretty good, but it lacks controls to adjust the filter color temperature, incrementally: no sliders, buttons or commands.

When I say "incrementally", what I mean is that I need a command to set color temperature according to the previous value. The package xbacklight has a good example:

xbacklight +10 #increases monitor brightness by 10%

or...

xbacklight -10 #decreases monitor brightness by 10%

Hence, if brightness value was 70%: now, it would become 60%.

What I need is a command like this:

temperature +10 #increases color temperature by 10%

what redshift already provides

With redshift, you can manually set color temperature like this:

redshift -O 3000K

Although, there's no built-in way to increase this value by 10%.

Therefore, if you need to increase the value, you need to do this:

redshift -x #reset the previous value
redshift -O 3300K

Notice that: not only I had to calculate the new value manually, I also had to reset the previous value, first.


why do I need to do this

I study all day, using my laptop. So, I need to have blue light filter on, in order to save my eyes and be more productive.

I have some some ideas on how to make a simple shell script that could do this, but I have no idea how I would go and store the previous value variable or where to store this kinda script properly.

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
  • Did you know you can give Redshift your latitude and longitude so that it automatically and incrementally changes the display? See `-l` for that and `-t` to set the temperature interval. – Quasímodo Feb 10 '21 at 14:42
  • @Quasímodo Yes. Although, I need to adjust these parameters manually because not always the color temperature set automatically is enough to relax my eyes. – surfboardcompound Feb 10 '21 at 14:44
  • You can also set the color temperature minimum and maximum. – l0b0 Feb 10 '21 at 21:59
  • @l0b0 what if I store a variable in `.profile`, so everytime I need to increment the old color temperature value I can use it from there? – surfboardcompound Feb 10 '21 at 23:08

1 Answers1

0

I figured it out and made a simple package called tempcolor.

Now, I'm able to even create keyboard shortcuts to change color temperature incrementally.

install

  • place the contents of the repo wherever you want to;
  • make tempcolor executable: chmod +x ./tempcolor;
  • feel free to create a symbolic link for tempcolor.
    • be it in /usr/bin;
    • or be it in $HOME/.local/bin.

usage

incrementally change color temperature

  • tempcolor -inc <percent_value>
  • tempcolor -dec <percent_value>

reset color temperature (turn off)

  • tempcolor -x

set value using one shot mode (-O)

  • tempcolor <value>