If you need a color picker regularly enough but not every five minutes, keeping a widget on your panel 24/7 may be overkill.
I prefer a global hotkey that triggers a picker and stays hidden otherwise. And we can hook right into the default KDE color picker, no need for additional packages.
The Solution: KWin D-Bus
We can do this by tapping directly into the KWin compositor using D-Bus. It’s fast and just works.
dbus-send --print-reply --dest=org.kde.KWin /ColorPicker org.kde.kwin.ColorPicker.pick
This will run the color picker. Pick a spot and click. As you will see it returns a uint32 (a big number), and we’ll need to convert that to a Hex code in the next step.
The One-Liner
For Wayland:
dbus-send --print-reply --dest=org.kde.KWin /ColorPicker org.kde.kwin.ColorPicker.pick | awk '/uint32/ {printf "#%06x\n", $2 % 16777216}' | wl-copy
This will run the color picker, convert the uint32 to hex and shove it straight into your clipboard, ready to be pasted.
For X11:
Swap wl-copy for xclip -selection clipboard.
Set the Global Hotkey
Don’t wrap this in a shell script unless you have to. KDE can handle this natively:
- Open System Settings > Shortcuts.
- Go to Commands and click Add New.
- Name: Global Color Picker.
- Command: Paste the one-liner above.
- Shortcut: Assign your favorite combo (e.g., Meta+Shift+C).
- Hit Apply.
And there you go. No wasted visual space. Just instant color pickings whenever you need it.
–
