This is an automatic theme switcher for Ubuntu 22.04 and 24.04.
It does the following:
-
Sets the light-theme at sunrise and automatically switches to the dark-theme at sunset. Affects the following:
- GTK-Theme
- Icon-Theme
- GNOME Shell Theme
- GNOME Terminal profile
-
Sets the prefer-light/prefer-dark value to indicate to programs and websites which version you prefer.
-
Sets the mouse cursor, if you use the Cinnamon desktop.
fix:
change gnome shell switcher from
gsettings set org.gnome.shell.extensions.user-theme name "$LIGHT_SHELL_THEME"
to
gsettings --schemadir $HOME/.local/share/gnome-shell/extensions/[email protected]/schemas set org.gnome.shell.extensions.user-theme name "$LIGHT_SHELL_THEME"
in order to solve
$> gsettings set org.gnome.shell.extensions.user-theme name "Yaru-blue" No such schema “org.gnome.shell.extensions.user-theme”
- you can also use gnome extension in
srcwithout install anything.
- Open the
auto-darkmode-switcher.shscript with a text-editor and add your latitude, longitude and preferred themes. - Execute the install script once:
sh ./install.sh. - If it complains about dependencies, install them and execute it again.
Depends on the program hdate to get an accurate sunrise and sunset time for your location. Uses the gnome-shell-extensions package to switch the Gnome Shell Theme.
Execute systemctl --user list-timers. If all went well, there should be a "auto-darkmode-switcher.time"-unit in the list. Exit by pressing Q.
Execute systemctl --user stop auto-darkmode-switcher.timer.
Follow the install-instructions if you want to start it again.