Keyboard shorcut for Nightlight Gnome 3.24 Ubuntu 17.04

If you are still wanting to know, this command worked for me,

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

Changing 'true' to 'false' turns it off. Worked it out after seeing this: https://www.reddit.com/r/gnome/comments/6cvlb6/how_to_configure_night_light_in_gnome_324x/


Are you still interested in this? If so, you can follow this guide

  1. Using script from @kapad - script, make file under ~/.local/share/myscript (you can use any folder name) with name togglens without any file extension
  2. Open terminal in that folder, and chmod +x togglens to make it executable
  3. Now create symlink for the file to /usr/local/bin using code sudo ln -s ~/.local/share/myscript/togglens /usr/local/bin/togglens
  4. Now you can set the keyboard shortcut to gnome setting using any combination you like, just put togglens in the command section.

Chiming in for Ubuntu 18.04 here-- I used the standard keyboard shortcut and was able to use the following command:

bash -c "if [[ $(gsettings get org.gnome.settings-daemon.plugins.color night-light-enabled) == "true" ]]; then gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled false; else gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled true; fi"

It's not super readable but it works. It's based on the script that @kapad wrote up on his or her Github; I simply shortened it to a one-liner so you could paste it right in. Now F7 is toggling the nightlight on my system!