A simple utility that listens for changes to the desired colour temperature and changes the light/dark mode OS theme accordingly.
auto-theme.webm
Use the install.sh script directly, or look at the contents to inspire a manual alternative...
curl -s "https://gist.githubusercontent.com/RobinKnipe/79c48673ce2c920d65e661d32df1eba9/raw/install.sh" | bash -sThe install script takes care of downloading the necessary files and registering a unit with systemd.
This means everything is running in the background ready to switch themes.
The utility should start immediately and make a switch if one is required.
The script is run as part of the user session and will persist across restarts, until disabled or removed using systemctl.
Set the desired light/dark theme names for your OS, and day/night colour temperatures, in the properties file.
By default it should be installed into the unit's directory at ~/.config/systemd/user/col-temp-switch/ct-switch.properties.
The script that detects and triggers the theme changes can also be found here (ct-switch.sh), and could be easily extended to trigger other actions.
The trigger is set at the midpoint between the day temp (6500, full white by default) and the "target" night temp, as set in your OS's Night Colour Control feature.
The day/night temps should be picked up from your existing OS settings, but can be configured (overridden) in the unit's properties file.
NOTE: after making changes to the properties file
systemdmust be notified before they take affect:systemctl --user daemon-reload systemctl --user restart col-temp-switch.service
This has been tested with Kubuntu, but other KDE/Plasma varients should also work, and the core concept of listening for dbus changes (with dbus-monitor) should be easy enough to implement for other systems.