GNOME Night Light Setting from the Command Line

5,984

To turn on:

gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled true

To turn off:

gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled false

To schedule on time, here I want to schedule night light from 23:06 hrs (that is 06/60=0.1):

gsettings set org.gnome.settings-daemon.plugins.color night-light-schedule-from 23.1

To schedule off time, I want to schedule night light off at 23:25 hrs (that is 25/60=0.416666666):

gsettings set org.gnome.settings-daemon.plugins.color night-light-schedule-to 23.416666666

You can also set the night light temperature which will increase and decrease the brightness, 4000 is the default value for Ubuntu 18.04, you can try different values for example 2000, 3000, 5000, 6000, 10000 and set the preferred ones:

gsettings set org.gnome.settings-daemon.plugins.color night-light-temperature 4000

To get the current values for above commands, run the below commands

gsettings get org.gnome.settings-daemon.plugins.color night-light-enabled 
gsettings get org.gnome.settings-daemon.plugins.color night-light-schedule-from
gsettings get org.gnome.settings-daemon.plugins.color night-light-schedule-to
gsettings get org.gnome.settings-daemon.plugins.color night-light-temperature

Example:

$ gsettings get org.gnome.settings-daemon.plugins.color night-light-enabled
false
$ gsettings get org.gnome.settings-daemon.plugins.color night-light-schedule-from
23.1
$ gsettings get org.gnome.settings-daemon.plugins.color night-light-schedule-to
23.416666666000001
$ gsettings get org.gnome.settings-daemon.plugins.color night-light-temperature
uint32 1000
$
Share:
5,984

Related videos on Youtube

stackinator
Author by

stackinator

Updated on September 18, 2022

Comments

  • stackinator
    stackinator over 1 year

    How do I turn the GNOME night light on or off from the command line? I've got the command gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled but don't know what flag/argument/whatever to put on the end of it.

    gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled ON
    gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled TRUE
    gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled YES PLEASE
    

    None of those work.

  • stackinator
    stackinator over 5 years
    I ended up using the sudo apt-get install sct package and it's as easy as sct 5000 or sct 2300 or sct to return to defaults.
  • Dean O'Brien
    Dean O'Brien over 3 years
    Is there a similar way to check that the night light is not just enabled, but actually active (e.g., if it's after sunset)? I want to make a script to check whether the night light is active and then conditionally start Terminator either with my "day" or "night" layout. I'd prefer not to just check time since that won't account for shorter winter days, & I figure GNOME is doing the more complicated stuff of checking my geolocation, time of year, etc, to calculate sunset/sunrise for the night light already, so I'd prefer not to reinvent that.