Skip to content

Twonkular/kswitch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kswitch

A simple command line tool for light/dark theme switching in KDE Plasma.

transition.gif

Features

  • 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

Installation Instructions

Dependencies

  • KDE Plasma (tested on 6.3.5)
  • dbus and qdbus for interfacing with KDE components
  • Rust (for building from source)
  • cargo for installation

From Source

git clone https://github.com/yourusername/kswitch
cd kswitch
cargo install --path .

Usage

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.

Configuration

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

Warnings

  • 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.

Tasks

  • CLI interface
  • Set
    • Global Theme
    • Terminal
      • Set default theme in .config/konsolerc
      • Set theme for existing terminal windows via D-Bus
    • 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

Future Improvements

  • Interactive configuration tool
  • Improve speed of synchronous switching
  • Prioritize visible windows during theme switch
  • Implement timed changes via systemctl and systemd 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

License

MIT License. See LICENSE file for details.

Contributions

Feel free to open issues or submit pull requests. Cannot promise I will look at them. Did this for myself to help learn Rust.

Existing solutions

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.

About

A simple command line tool for light/dark theme switching in KDE Plasma.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages