I’m pleased to announce the release of darkman 1.0. Darkman is a session service that transitions a desktop environment between colour schemes. It switches to dark mode at sundown, and back to light mode at sunrise.
This small project started in 2020, out of frustration with dark mode being too hard to read during sunny days, and light mode being blinding at night-time.
Darkman runs as a session service. It sets a timer for the next sunrise/sundown based on the current location and sleeps 99% of the time.
There’s a few different features that have gradually sprung up over these many months:
- scripts: darkman will run scripts in
/.local/share/dark-mode.d
(and/.local/share/light-mode.d
). These scripts can be used to reconfigure software that doesn’t support transitions, change the settings for applications, change the current GTK theme, etc. There’s a few example ones in the git repo. - XDG portal: darkman implements the
org.freedesktop.impl.portal.Settings
D-Bus API, so applications that use the standard desktop portals to determine the current preference will also pick up the correct value. Support for this is gradually picking up. - D-Bus API: darkman exposes its own D-Bus API to query the current mode and also change it. This API is designed for unsandboxed clients.
- command line:
darkman set MODE
anddarkman get
can be used for scripts (it simply uses the above D-Bus API). - location: the current location will be determined using geoclue. In cases where using geoclue is not an option, it’s possible to disable it and configure the location manually via the [optional] config file.
Handling systems going into sleep mode was also tricky – regular timers stop ticking when the system goes to sleep, so had to find the right timer that doesn’t run off-schedule when system goes to sleep and wakes up again.
Darkman runs on Linux. I’ve only used it on Linux desktop, but there’s no reason why it wouldn’t work on Linux mobiles. If you give it a shot I’d be glad to hear your results! Darkman should run on BSDs, but has not been tested so far.
Check out the README for installation instructions for setup instructions.
Patches are welcome! If you find this useful, consider leaving a tip.