Fixing Key Repeats with Wacom ExpressKey Remote Under Wayland (Sorta)
I've been having an issue for the past several months where my Ctrl-Z keybind on my Wacom ExpressKey would sometimes have "sticky" keypresses and think the button was held down when it wasn't. I'm sharing my solution in hopes of saving someone else the time and headache.
If you just want the solution, here's the quick version:
- Install input-remapper
- Configure the selected button as the macro
modify(KEY_LEFTCTRL, key(KEY_Z))
Let me go more into detail of the issue and solutions I tried.
I've had this issue in some form for as long as I've had the Remote. It started out differently under X11, though: the Ctrl key would sometimes stick when I'd hit undo. It was annoying because I'd end up resizing my brush or selecting new colors unintentionally, but was otherwise kinda harmless.
However, the greater Linux desktop ecosystem, including my beloveds Arch Linux and KDE, are pushing to move to Wayland. Wayland handles inputs drastically differently than X11, and the bug now did more than pretend to hold down Ctrl: it'd hold down Z as well. This meant that it would sometimes undo 5-20 stroke's worth of progress. And if I didn't realize it fast enough and made a new mark? Then the timeline where I'd made those strokes was discarded and I'd lose progress on my art.
To make matters worse, the issue was intermittent (only a few times an hour at most). And staring at terminal windows of debug utilities repeatedly pressing the same button at a steady interval to hopefully see one of the button release signals being lost isn't exactly my idea of a good time.
I have yet to find the source of the problem but I'll list what other solutions I tried:
- Using a different Remote device
- Using a different USB receiver
- Using a different USB port (one on my motherboard instead of the one built into the back of the tablet)
- Doing all 3 of the above while the original set I had was disconnected and turned off
- Closing Fcitx5
- Disabling global hotkey repeat
- This one did technically work, but with the caveats that it seems to only last until I reboot (perhaps another bug) and that I don't really want to do this because having Ctrl-Z actually repeat undos is useful for me when I actually want it.
- Binding the hotkey on the remote to the letter "W" so that it isn't trying to use a modifier key
- Configuring the Remote button within Wayland to "Defer to Application" (doesn't seem to register anything within the Krita build I have)
I eventually got the recommendation to install the utility input-remapper. After some futzing with it, I figured out a macro to do the keypresses I wanted: modify(KEY_LEFTCTRL, key(KEY_Z)) . It's self-documenting enough, but basically it says "hold down the left control key and press Z for 10ms". The only downside to this method is that I have to launch input-remapper each time I want to use it (not that I've looked into fixes for this yet) and that I can't hold down the key for repeated undos anymore. I think I can accept that last bit, though. :p