Quick Fix: Getting Clipman to Work with Wofi Height Settings
I ran into a silly little issue today while setting up clipboard management in Sway. I wanted to use clipman with wofi as my picker, and I specifically wanted the picker window to be 260px tall.
My first attempt was the obvious one:
clipman pick -t wofi -H 260
But instead of a nice clipboard picker, I got slapped with:
clipman: error: unknown short flag '-H', try --help
Well, that’s embarrassing. Turns out I was being dumb. The -H 260
flag isn’t for clipman at all, it’s for wofi! I was passing wofi’s arguments directly to clipman, which had no idea what to do with them.
The Actual Solution
The right way to do this is with clipman’s --tool-args
option:
clipman pick -t wofi --tool-args="-H 260"
This tells clipman to use wofi and passes the height argument where it actually belongs.
Why This Even Happened
Here’s the weird part. This whole thing started because I tweaked my display scaling in Sway. I’d been happily using this keybinding for ages:
bindsym Mod1+h exec clipman pick -t wofi
Everything worked great until I adjusted my laptop’s DPI settings. I bumped the scale from 2 to 2.2 because things were getting too small for my tired eyes:
output eDP-1 scale 2.2
At home I use an external monitor scaled to 1.25:
output HDMI-A-1 scale 1.25
After that scale change, clipman started acting weird on the external monitor. It would work fine on the laptop screen but completely fail when I switched to the external display. Running it from terminal gave me this lovely error:
Gdk-Message: 18:14:23.630: Error flushing display: Protocol error
I spent way too much time googling that error message with zero useful results.
The breakthrough came when I accidentally tried setting the wofi height explicitly:
clipman pick -t wofi --tool-args="-H 260"
Suddenly everything worked perfectly, even on the external monitor. Go figure.
I still don’t fully understand why the height setting fixes the display protocol error, but hey, sometimes you take the wins where you find them.
My Current Setup
Now my Sway keybinding looks like this:
bindsym mod1+h exec "clipman pick -t wofi --tool-args='-H 260'"
Or if you prefer keeping scripts separate, which I usually do:
bindsym mod1+h exec "~/.config/sway/scripts/clip-picker.sh"
With the script containing:
#!/bin/bash
clipman pick -t wofi --tool-args="-H 260"
Don’t forget to make it executable:
chmod +x ~/.config/sway/scripts/clip-picker.sh
Takeaway
Sometimes the solution to a mysterious technical problem is just properly reading the documentation. The --tool-args
flag exists specifically for passing arguments to the picker tool, but it’s easy to miss when you’re in “just make it work” mode.
Hope this saves someone else a few minutes of head scratching!