Force GNOME Night Light to stay on and never turn off

8,896

Solution 1

The "native" way for Gnome Shell to always keep your nightlight color on involves to access some hidden options in dconf-editor. dconf-editor is not installed by default on Ubuntu 18.04. You may need to install it first.

  • Open dconf-editor and navigate to the key /org/gnome/settings-daemon/plugins/color/
  • Set night-light-schedule-automatic to false
  • Set night-light-schedule-from to 0, and night-light-schedule-to to 24 (or any value higher than this)

You can also adjust your color temperature there.

In Ubuntu versions later than 18.04, these settings are exposed in "Settings", under "Displays".

Solution 2

I was similarly looking for a way to keep it on at all times but didn't see a way through the GUI. The other answers work but I found a simpler way to enable it via terminal without having to install any additional tools:

gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled true
gsettings set org.gnome.settings-daemon.plugins.color night-light-schedule-automatic false
gsettings set org.gnome.settings-daemon.plugins.color night-light-schedule-from 0
gsettings set org.gnome.settings-daemon.plugins.color night-light-schedule-to 24
gsettings set org.gnome.settings-daemon.plugins.color night-light-temperature 5000

To get an idea of temperature value ranges, Redshift uses default values of 3700 at night and 5500 during the day.

Solution 3

Another alternative is sct which you can install with sudo apt install sct.

$ sct -h
Usage: sct [temperature]
Temperatures must be in a range from 1000-10000
If no arguments are passed sct resets the display to the default temperature (6500K)
If -h is passed sct will display this usage information
$ 

Putting sct 3500 or whatever other value you prefer in your autostart should do it.

Solution 4

The question can be reframed to "How can I have screen color temperature at 5000 all the time?".

In this case you can use xrandr to set the color temperature. From these notes:

/* -----------------------------------------------------------------------------
    Dec 9, 2018 - Future Help Screen? Below taken from `sct` C source code:

/* cribbed from redshift, but truncated with 500K steps */
static const struct { float r; float g; float b; } whitepoints[] = {
    { 1.00000000,  0.18172716,  0.00000000, }, /* 1000K */
    { 1.00000000,  0.42322816,  0.00000000, },
    { 1.00000000,  0.54360078,  0.08679949, }, /* 2000K */
    { 1.00000000,  0.64373109,  0.28819679, },
    { 1.00000000,  0.71976951,  0.42860152, }, /* 3000K */
    { 1.00000000,  0.77987699,  0.54642268, },
    { 1.00000000,  0.82854786,  0.64816570, }, /* 4000K */
    { 1.00000000,  0.86860704,  0.73688797, },
    { 1.00000000,  0.90198230,  0.81465502, }, /* 5000K */
    { 1.00000000,  0.93853986,  0.88130458, },
    { 1.00000000,  0.97107439,  0.94305985, }, /* 6000K */
    { 1.00000000,  1.00000000,  1.00000000, },             /* 6500K */
    { 0.95160805,  0.96983355,  1.00000000, }, /* 7000K */
    { 0.91194747,  0.94470005,  1.00000000, },
    { 0.87906581,  0.92357340,  1.00000000, }, /* 8000K */
    { 0.85139976,  0.90559011,  1.00000000, },
    { 0.82782969,  0.89011714,  1.00000000, }, /* 9000K */
    { 0.80753191,  0.87667891,  1.00000000, },
    { 0.78988728,  0.86491137,  1.00000000, }, /* 10000K */
    { 0.77442176,  0.85453121,  1.00000000, },
};

----------------------------------------------------------------------------- */

You can see 5000K is:

{ 1.00000000,  0.90198230,  0.81465502, }, /* 5000K */

So you can use xrandr like this

xrandr --output DP-1 --gamma 1:.90:.81

Do this on startup and forget about Night Light or any other add on.


Ironically looking at the code redshift (at night) mostly entails blue shift + green shift (reduction).

Share:
8,896
stackinator
Author by

stackinator

Updated on September 18, 2022

Comments

  • stackinator
    stackinator over 1 year

    There's a manual option to set the times you want GNOME night light to be on and off. I want it always on.

    The closest I can get is to set it to turn on at 00:00 and turn off at 23:59. But then at midnight it goes off for a minute which is annoying. Then I have to turn it back on through the settings. How do I force it "always on".

    • Boris Hamanov
      Boris Hamanov over 5 years
      Just curious. Why do you want Night Light ON all the time? There are other programs that can change screen gamma/temperature, as outlined in some answers below.
    • stackinator
      stackinator over 5 years
      @hennema because I don't like the default 6500 daylight setting. I find 5000 more pleasing to the eye during the day. Yes there are other programs but Night Light is included by default, why install additional programs if you don't have to? My two cents.
  • stackinator
    stackinator over 5 years
    And you can manually change the color at any time in the terminal with the following ('5000' can be any value) gsettings set org.gnome.settings-daemon.plugins.color night-light-temperature 5000
  • Dagelf
    Dagelf almost 4 years
    This only sets colors on some programs, not all
  • WinEunuuchs2Unix
    WinEunuuchs2Unix almost 4 years
    @Dagelf since xrandr is the heart of the system or the meat & potatoes as it were, it would be interesting if you would list at least one of the programs that do not honor xrandr settings.
  • Dagelf
    Dagelf almost 4 years
    I'll have to try it on my amdgpu machine again... I could've been mistaken and it could've been that some programs only used full bright colours, which do not seem to be affected by gamma settings... I've settled on using the "sct" command - curious about what it does differently
  • WinEunuuchs2Unix
    WinEunuuchs2Unix almost 4 years
    @Dagelf I haven't looked at sct source code but I assume it uses xrandr like eyesome does but the others use some sort of sophisticated color management engine that lays over top of xrandr.
  • Dagelf
    Dagelf almost 4 years
    Whoaa... I just compared the source... and... there's a bug in the xrandr utility. It doesn't fill the gamma table with the right values, where sct does. Going to do a pull request with a fix now.