DEV Community

Cover image for Automatically change the theme in Ubuntu depending on the time of day
Irvirty
Irvirty

Posted on

Automatically change the theme in Ubuntu depending on the time of day

Steps:

Download the Gnome extension:

Night Theme Switcher - https://nightthemeswitcher.romainvigier.fr/ or https://extensions.gnome.org/extension/2236/night-theme-switcher/

Create 2 bash scripts:

day.sh with this code to change the theme:
gsettings set org.gnome.desktop.interface gtk-theme 'Adwaita-lgiht';
gsettings set org.gnome.desktop.interface color-scheme 'prefer-light';

night.sh:
gsettings set org.gnome.desktop.interface gtk-theme 'Adwaita-dark';
gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'

In the extension settings "Commands" insert these scripts to execute:

For sunrise: bash /path/day.sh
For sunset: bash /path/night.sh

Done.

Top comments (0)