KNightTime in KDE Review

Vlad Zahorodnii vlad.zahorodnii at kde.org
Thu May 29 19:02:15 BST 2025


Hello,

KNightTime (https://invent.kde.org/vladz/knighttime) provides scheduling 
helpers for the dark-light cycle. Intended users are KWin, plasmashell. 
It can be used for Night Light, Day/Night wallpapers, changing the color 
scheme or the desktop theme based on time of day.

Currently, the problem is that one has to write a bit of code to 
properly calculate transition timings. Also, they have to provide some 
options to configure the timings. If there are multiple features that 
synchronize to the dark-light cycle, it's going to be inconvenient to 
configure them one by one. KNightTime provides a client library and a 
daemon that clients can subscribe to for timing updates. Also, 
KNightTime can be used without a daemon. In that case, it is up to you 
to expose configuration options, etc. With a daemon, only it has to be 
configured. Another bonus point in favor of a daemon is that for some 
projects, it would be nice not to link with geolocating libraries, e.g. 
KWin, to keep the dependencies somewhat reasonable. 
https://invent.kde.org/plasma/kwin/-/tree/work/zzag/knighttime?ref_type=heads 
shows how to port Night Light to KNightTime.

When the daemon is used, the geolocation data is not shared with the 
client for privacy reasons. The daemon sends a forecast of transitions 
for upcoming N days. If the client runs out of that forecast, it'll 
extrapolate the schedule from the last received day, although in 
practice it should happen rarely, until the daemon provides a new update.

The intended place for KNightTime to live is plasma.

Regards,
Vlad



More information about the Plasma-devel mailing list