Files

2.8 KiB

Konsole Day/Night

Note: the "How it works", "Requirements" and "Troubleshooting" sections of this README were written by an AI assistant (Particle-1) on the maintainer's behalf on 2026-12-01, by reading the code. The original daemon and its setup notes are the maintainer's; corrections welcome.

A daemon that switches your Konsole colour profile when Plasma flips between dark and light mode. Plasma changes its own colours on schedule or on sunrise and sunset; the terminal does not, and a light background in a dark session is the sort of thing you notice twenty times a day.

How it works

  1. Subscribes to SettingChanged on the xdg-desktop-portal KDE implementation over DBus and reads the org.freedesktop.appearance → color-scheme key (1 is light, 0 is dark).
  2. Falls back to the org.kde.kdeglobals.General → ColorScheme string when the portal stays quiet, matching dark or light in the scheme name.
  3. Writes DefaultProfile in konsolerc with kwriteconfig6 so new terminals pick the profile up, and applies it to running Konsole sessions.

Requirements

  • KDE Plasma 6 with Konsole (the portal and kwriteconfig6 are KDE-specific)
  • Python 3.12+ and uv: pyproject.toml pins the dependencies, including pydbus and loguru

Setup

  • Use uv to install dependencies and run.
uv venv
uv sync

Config

  • By default looks for profiles named Light and Dark
  • Can configure with --dark_profile and --light_profile

Usage

uv run konsoltheme --dark_profile "Dark" --light_profile "Light"

Systemd Auto-start

You can use the provided systemd unit file to automatically start the background process when you log in.

  1. Create the systemd user directory if it doesn't exist:

    mkdir -p ~/.config/systemd/user/
    
  2. Copy or link the service file:

    # Adjust path to where you cloned the repo
    ln -s $(pwd)/systemd/user/konsole-daynight.service ~/.config/systemd/user/
    
  3. Reload systemd and enable the service:

    systemctl --user daemon-reload
    systemctl --user enable --now konsole-daynight.service
    
  4. Check the status:

    systemctl --user status konsole-daynight.service
    

Note

The service file assumes you are using uv and the project is located at ~/Documents/src/konsole_daynight. If your setup is different, you may need to edit the ExecStart line in the service file.

Troubleshooting

# see what the listener is receiving
uv run konsoltheme --dark_profile "Dark" --light_profile "Light" 2>&1 | grep -i "DBus signal"

# the profile names must match what Konsole shows under Settings -> Manage Profiles
kreadconfig6 --file konsolerc --group "Desktop Entry" --key DefaultProfile

Logs go to the journal when started from the unit: journalctl --user -u konsole-daynight -f.