354.1. knighttime-6.8.2
Day and night schedule library and session daemon, for Night Light and automatic light and dark themes
6.8.2-1 · (GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL) AND (LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL) AND CC0-1.0 AND BSD-3-Clause AND MIT · 0.6 SBU · 385.9 KiB, 26 files · 50_desktop, 1 of 92 · ports/core/kde/knighttime
Homepage: https://invent.kde.org/plasma/knighttime
Why it is in KDOS. The comment above it in script/phases/50_desktop/packages.txt:
The day and night schedule behind Night Light and automatic light and dark themes.
KNightTime decides when the day ends and the night begins. Its daemon, knighttimed, works the schedule out from sunrise and sunset at the machine’s location, or from fixed times, and serves it on the session bus as org.kde.NightTime; the KNightTime library is the client side, which subscribes to that schedule. kwin’s Night Light follows it to warm the screen colour, and Plasma’s automatic switch between a light and a dark theme follows it too. The settings are ~/.config/knighttimerc.
Depends on: cmake, ninja, extra-cmake-modules, qt6-qtbase, qt6-qtpositioning, kconfig, kcoreaddons, kdbusaddons, kholidays, ki18n, dbus.
Required by (3): kde-plasma, kwin, plasma-workspace.
Sources: knighttime-6.8.2.tar.xz (39.5 KiB). Every step kpkg takes applies to this port.
Install: script/chroot/exec.sh bash -c 'source script/phases/50_desktop/phase.env && kpkg install knighttime'
build.sh:
cmake -S . -B build -G Ninja \
-D CMAKE_INSTALL_PREFIX=/usr \
-D KDE_INSTALL_LIBDIR=lib \
-D CMAKE_BUILD_TYPE=Release \
-D KDE_INSTALL_USE_QT_SYS_PATHS=ON \
-D BUILD_TESTING=OFF \
-D KF_SKIP_PO_PROCESSING=ON \
-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --install build
rm -rf "$PKG/usr/lib/systemd"
-D KF_SKIP_PO_PROCESSING=ON— Compiles none of the translation catalogues. kpkg removes every non-English catalogue from the package anyway (see Size and language policy), so this only saves build time.-Wno-dev— Silences CMake’s warnings meant for the project’s own developers.
Libraries: libKNightTime.so.
Directories: /usr/include/KNightTime, /usr/lib/cmake/KNightTime, /usr/share/licenses/knighttime.
The daemon is started by D-Bus activation. The install writes /usr/share/dbus-1/services/org.kde.NightTime.service, whose Exec= line names /usr/lib/libexec/knighttimed and which the session bus runs the first time a client asks for the name; its SystemdService= line is read only by a bus that systemd starts. The install also puts the systemd user unit that line names, plasma-knighttimed.service, under /usr/lib/systemd; build.sh removes the directory, since KDOS has no systemd (see No systemd).
Sunrise and sunset come from kholidays’s SunEvents. The location is either typed in, or, with automatic location on (the default), asked of Qt Positioning’s default source through qt6-qtpositioning, whose GeoClue plugin asks GeoClue on behalf of the desktop id org.kde.knighttimed; the hidden desktop entry the port installs under that name is the identity GeoClue authorises. When no position source answers, the daemon falls back to the fixed times, 06:00 and 18:00 with a 30-minute transition unless they are changed, and it keeps the last position it was given in ~/.local/state/knighttimestaterc.