Night Theme Switcher
Automatically toggle your desktop’s color scheme between light and dark, switch backgrounds and run custom commands at sunset and sunrise.
Graphical installation
Visit the extension page on extensions.gnome.org and enable the extension.
Command line installation
You will need these tools:
mesongettextglib-compile-schemasglib-compile-resources
Clone the repository and enter the directory:
git clone https://gitlab.com/rmnvgr/nightthemeswitcher-gnome-shell-extension.git && cd nightthemeswitcher-gnome-shell-extension
Build and install using meson:
# System-wide installation
meson setup builddir && meson install -C builddir
# User installation
meson setup builddir --prefix=~/.local && meson install -C builddir
Restart your GNOME session and enable the extension:
gnome-extensions enable nightthemeswitcher@romainvigier.fr
Contributing
You're welcome to contribute to the code or the translations! See CONTRIBUTING.md.
Frequently asked questions
Some applications don't switch their appearance
Like GNOME's built-in dark mode, the extension switches the standard freedesktop.org color scheme preference. Older applications might not follow this preference.
It is possible to force a GTK theme by running commands in the extension preferences, but please note that this can visually break applications. It is better to ask the developers of the applications to support the standard preference.
gsettings set org.gnome.desktop.interface gtk-theme $THEME_NAME
Something doesn't work on Ubuntu
Unfortunately, Ubuntu ships heavily modified GNOME components to implement some of its features, like accent colors. Because it does so in a very hacky way instead of working with upstream and other desktop projects on a proper solution, it conflicts with anything that deals with the color scheme and themes, and results in a broken experience with the extension.
As the issue is in Ubuntu, and because I don't have the energy nor the will to work around the consequences of their decisions, unfortunately Ubuntu is not supported until it provides a standard GNOME environment.
I have disabled Location services but want to use sunrise and sunset times from my location
If you know your coordinates, you can enter them in a hidden setting, and the extension will use them to calculate the sunrise and sunset times. You can set it with the gsettings command:
gsettings --schemadir ~/.local/share/gnome-shell/extensions/nightthemeswitcher@romainvigier.fr/schemas/ set org.gnome.shell.extensions.nightthemeswitcher.time location '($LATITUDE,$LONGITUDE)'
I want to use the prefer-light color scheme or change the color scheme used during the day/night
There are two hidden settings to change the color scheme used during the day or night:
gsettings --schemadir ~/.local/share/gnome-shell/extensions/nightthemeswitcher@romainvigier.fr/schemas/ set org.gnome.shell.extensions.nightthemeswitcher.color-scheme day $DESIRED_COLORSCHEME
gsettings --schemadir ~/.local/share/gnome-shell/extensions/nightthemeswitcher@romainvigier.fr/schemas/ set org.gnome.shell.extensions.nightthemeswitcher.color-scheme night $DESIRED_COLORSCHEME
With $DESIRED_COLORSCHEME one of default, prefer-dark or prefer-light.
