An issue I recently had with Linux Mint is that I can't bind the Space key (or any keyboard key) to the button of the stylus (the "pen") of my Wacom graphics tablet. There is an interface to configure the graphics tablet input, but it doesn't let you use arbitrary keys. You may be wondering why do I even need to do this in first place. That's because some applications, like FireAlpaca, do not support panning the view by holding the middle mouse button, they expect you to hold Space key to pan, and I don't want to do that, so I want to bind the stylus button to the Space key so that I can just pan by holding the stylus button.
Observation: I don't have the faintest idea about whom is responsible for this interface. Was this made by Mint? It has these annoying GNOME headerbars, so is it by GNOME? By a third party? Is this a fork? Whom do I complain to? Does anyone expect me to google "graphics tablet linux mint" to find who made this app? Or is it a strategy to avoid getting issue tickets? It really drives me insane that I don't have a Help -> About
or something equivalent. On Windows, all system utilities like these do have a Help -> About
(e.g. Regedit, Device Manager, etc.), or at least they used to have them when Windows had good UI. Literally you could just brand it. Just place Mint's logo on a corner and tell people "if you see this, it's one of ours." It seems other operating systems have the functionality1 (I'm not sure if this is KDE or GNOME, but it seems to use the same pen graphic? Or was it a mockup?). It's very frustrating that these applications seem so similar, yet they have different sources and sets of features.
How to Fix
There are two workarounds for this, as far as I know.
The first is to install OpenTabletDriver [https://opentabletdriver.net/] and disable your Wacom drivers, then you get the same set of features no matter what operating system you use. I'd rather not do this, because last time I did it I forgot to write down everything I did (silly me, right?) because there is no GUI that you can just switched on and off, activate and undo, it's "run this terminal command," "copy this file to this root-owned directory," etc., so in the end I had OpenTabletDriver working, but it didn't work really well, and I had no idea how to reactivated the Wacom drivers because none of the tutorials to blacklist kernel modules I found seemed to be the method I used to make them disappear. I guess I just deleted the files, then? I don't really remember what I had to do to make it work.
The second is use the xsetwacom
command-line utility, which means 3 things:
- It probably only works on X11, not Wayland.
- It probably only works on Wacom tablets.
- You need the terminal.
Not very good, but I guess I'll just use this method until I can't anymore. If someone asks why I can't use Wayland, I'll just tell them I'm waiting for my operating system's graphics tablet settings app to have feature parity with the X11 exclusive command-line utility I need to make an application I want to use work.
1: open the terminal [how?] and type the following command:
xsetwacom --list
The output will be a list of connected devices. In my case it was:
Wacom Bamboo One M Pen stylus id: 10 type: STYLUS
Wacom Bamboo One M Pen eraser id: 15 type: ERASER
You may be wondering what in the world is an "eraser." Well, in some cases the stylus has a sensor in both tips of the pen, so there's the pen nib that everyone normally uses, and on the opposite side you have the eraser, which means you can flip the stylus around like a pencil to erase. I've never actually used this.
2: use the information of the stylus device provided to bind the key.
This might require some tinkering depending on your tablet. In my case, I ran the following command to bind the space key to the lower button of the stylus:
xsetwacom --set "Wacom Bamboo One M Pen stylus" Button 2 "key +space"
If you don't want to type the whole name of the device, you can use the id
.
xsetwacom --set 10 Button 2 "key +space"
Observe that the binding is for Button 2
. This is the lower button in my case. I assume Button 1
is the top button. I only have two buttons. If you have more buttons you'll need to test every button until you find the one you want.
The text code for the binding is key +space
. The key
means is it's bound to a key (not to a mouse button), and space
is the name of the key. But what is the +
?
If you use key space
, then xsetwacom
will trigger a single key press and release when you press the button, so it will work just like a keyboard key. If you hold it pressed, it will start repeating.
If you use key +space
, the space key will be "held" until you release the button, which is what you would normally want.
3: save the code as a .sh
file somewhere so you can run it when you need. Make sure you add the #!/bin/sh
shebang so it's interpreted correctly.
#!/bin/sh
xsetwacom --set 10 Button 2 "key +space"
Personally I just leave it in a folder so I can double click on it if I want to use FireAlpaca. You could make the script run automatically when you login, or you could save it in ~/.local/bin/MakeStylusButtonSpace.sh
so you can always run it from the terminal by running:
MakeStylusButtonSpace.sh
Other Keys
If you want to bind it to another key name, run:
xsetwacom --list modifiers
To get a list of supported key names.
References
- https://github.com/linuxmint/cinnamon-control-center/issues/76#issuecomment-69504476 (accessed in 2024-09-05) ↩︎
Leave a Reply