Simple titlebar color changer for KDE
Titlebar Kolor Picker (or tkp) is a simple interactive shell script that lets you choose application/window specific titlebar color-scheme. This is useful when titlebar feels out of place on GUI applications that do not utilize KDE's colors or when app's CSD (Client side rendering) breaks window decoration consistency.
here are some examples how it can help make UI clean and a bit more modern.
- xprop
- kcolorchooser
- bc
- X11 session (wayland not tested nor supported. The script uses X11 tools)
Download the script by cloning the repository
git clone https://github.com/siggsy/Tkp
or by downloading the script tkp
directly from the browser and placing it in the folder in PATH. Make sure the script is executable chmod +x tkp
All the rules can be removed by going to Window Rules
and deleting the rule named Titlebar color for your-app
.
tkp # Interactive mode
tkp "RR,GG,BB,AA" # Manual RGBA (dec)
tkp "#RRGGBB" # Manual RGB (hex)
tkp "#AARRGGBB" # Manual ARGB (hex)
Some variables can be changed in the script
DARK_COLOR_SCHEME
: path to the dark color-schemeLIGH_COLOR_SCHEME
: path to the light color-schemePREFIX
: Prefix to use when creating window rules and color-schemes
The script first uses xprop
to acquire window's WM_CLASS
used for KDE's window rules to apply color only to that specific app. Next, the script runs kcolorchooser
to grab a color from the screen to use it as titlebar background. Color is then evaluated and based on contrast standards the right color-scheme variant is selected to be overridden so title text is visible even on white titlebars (see Typora example).
Because the color-scheme is only used for the titlebar, just changing every occurrence of BackgroundNormal and BackgroundAlternate works relatively well.
- Window Rules file:
~/.config/kwinrulesrc
. - Color Scheme directory:
~/.local/share/color-schemes/
Picking color from Konsole always returns #000000xprop
sometime returns WM_CLASS with more than one value. Currently it's set to use the last in the list, but it isn't tested or researched if this applies globally
-
Re-apply configuration after modifying existing color scheme - Show prompt asking if the automatic color-scheme selection is correct/preferred
- Change button colors depending on contrast (might be tricky, since not everyone uses default window decorations)