Automatically Switch To Light / Dark Themes Based On Sunrise And Sunset Times With AutomaThemely

If you're looking for an easy way of automatically changing your desktop theme based on sunrise and sunset times, give AutomaThemely a try.

AutomaThemely Settings

AutomaThemely is a Python application that automatically changes Gnome themes according to light and dark hours, useful if you want to use a dark Gtk theme at night and a light Gtk theme during the day.

Besides automatically changing the Gtk3 theme, AutomaThemely can also automatically switch between dark and light themes for Atom editor and VSCode, as well as between light and dark syntax highlighting for Atom editor. This is obviously also done based the time of day.

AutomaThemely Atom VSCode
AutomaThemely Atom and VSCode theme / syntax settings

The application uses your IP address to determine your location in order to retrieve the sunrise and sunset times, and requires a working Internet connection for this. However, you can disable automatic location from the application user interface, and enter your location manually.

From the AutomaThemely user interface you can also enter a time offset (in minutes) for the sunrise and sunset times, and enable or disable notifications on theme changes.

Update: The application initially only supported changing Gtk themes on Gnome (or Unity), but with the new 1.3 release, it adds support for KDE Plasma, Xfce and Cinnamon, as well as changing the Gnome Shell and icon theme.

The latest AutomaThemely also includes a revamped settings manager, and support for custom scripts that can be triggered on sunrise and sunset.

Downloading / installing AutomaThemely

Ubuntu 18.04: using the link above, download the Python 3.6 DEB which includes dependencies (python3.6-automathemely_1.2_all.deb).

Ubuntu 16.04: you'll need to download and install the AutomaThemely Python 3.5 DEB which DOES NOT include dependencies (python3.5-no_deps-automathemely_1.2_all.deb), and install the dependencies (requests, astral, pytz, tzlocal and schedule) separately, using PIP3:

sudo apt install python3-pip
python3 -m pip install --user requests astral pytz tzlocal schedule

The AutomaThemely download page also includes RPM packages for Python 3.5 or 3.6, with and without dependencies. Install the package appropriate for your Python version. If you download the package that includes dependencies and they are not available on your system, grab the "no_deps" package and install the Python3 dependencies using PIP3, as explained above.

Using AutomaThemely to change to light / dark Gtk themes based on Sun times

To set AutomaThemely to change your theme according to light and dark hours, set the desired light and dark themes, then right click the application icon and select "Update sun times", followed by another right click, this time selecting "Restart the sqcheduler".

If your desktop environment doesn't support these right click actions, you can perform these operations by using these commands:

automathemely --update
automathemely --restart