A simple command line tool for light/dark theme switching in KDE Plasma.
- Command line interface to set or toggle theme
- Easy to configure a keyboard shortcut — just make a keyboard shortcut for
kswitch toggle
- Configurable through a simple config file (
~/.config/kswitch/config.toml
by default) - Switches Konsole default theme and also updates theme for all open Konsole instances
- Synchronous, multithreaded design for smoother transitions
- KDE Plasma (tested on 6.3.5)
dbus
andqdbus
for interfacing with KDE components- Rust (for building from source)
cargo
for installation
git clone https://github.com/yourusername/kswitch
cd kswitch
cargo install --path .
kswitch toggle # Toggle between light and dark themes
kswitch set light # Force light mode
kswitch set dark # Force dark mode
kswitch config edit # Open config in your default editor
You can create a custom keyboard shortcut in KDE System Settings to run kswitch toggle
.
kswitch
uses a simple TOML config file located at:
~/.config/kswitch/config.toml
It includes paths and names of your preferred themes, wallpapers, etc. The config can be created or edited via:
kswitch config edit
- Currently tested only on KDE Plasma 6.3.5 (Manjaro Linux).
- Functionality may vary or break on other Plasma versions or KDE-based environments.
- Use at your own risk and backup your theme settings.
- CLI interface
- Set
- Global Theme
- Terminal
- Set default theme in
.config/konsolerc
- Set theme for existing terminal windows via D-Bus
- Set default theme in
- Color Scheme
- Wallpaper
- Cursor Theme
- Kvantum engine theme (for Qt apps)
- Environment variable setting to track light/dark state
- Get
- Current state from environment variable
- Default theme based on time and config
- Set Themes
- Light
- Dark
- Toggle
- Config
- Config struct
- Read from file
- Save to file
- Edit via default editor
- Auto-create at default location
- Config struct
- Interactive configuration tool
- Improve speed of synchronous switching
- Prioritize visible windows during theme switch
- Implement timed changes via
systemctl
andsystemd
timers - Create custom wallpaper plugin using QML/Plasmoid for transition effects
- Add support for user-defined scripts:
~/.config/kswitch/light.sh
~/.config/kswitch/dark.sh
- Allow disabling individual features (e.g., don't change wallpaper)
- Replace binary dependencies with full D-Bus control
- Automatic scheduling based on user config
- Sunrise/sunset-based scheduling using
sunrise
MIT License. See LICENSE
file for details.
Feel free to open issues or submit pull requests. Cannot promise I will look at them. Did this for myself to help learn Rust.
Take a look at koi and YinYang. These do similar things, but there is no way to create a keyboard shortcut in Koi, and YinYang feels slow. Neither offer theme switching on Konsole sessions.