I’ve been looking for a way to bind my tablet and stylus buttons for a while and haven’t found a good permanent solution yet. I have an old Wacom Intuos3 and I’m running Mint 20. This post made me hopeful. @Rebecca wrote about saving a script within Krita itself using Ten Scripts, and I would love more details. I tried what was suggested, and the script was running, but it wasn’t working. Does anyone have any suggestions? It would be sooooo helpful to be able to use all those buttons, especially for the stylus.
The Python script in the linked post relies on xsetwacom, which is a command line tool to configure tablets. First of all, you need to make sure it’s actually installed on your system. Then you need to find out the name of your device. With your tablet plugged in, open a terminal window and type:
xsetwacom --list
My output looks like this:
Wacom Bamboo 2FG 6x8 Pad pad id: 10 type: PAD
Wacom Bamboo 2FG 6x8 Pen stylus id: 11 type: STYLUS
Wacom Bamboo 2FG 6x8 Pen eraser id: 12 type: ERASER
Wacom Bamboo 2FG 6x8 Finger touch id: 18 type: TOUCH
The PAD (first one in this case) is the one we need. Now you need to figure out what your buttons are named. I don’t think there’s an easy way to figure out, but the Wacom tablet buttons tend to be called “Button 1” etc, though the numbers are somewhat arbitrary. Mine are (from top to bottom) “Button 3”, “Button 8”, “Button 9”, “Button 1”. ![]()
I just went through all the numbers and tried to assign a key and tested if that had any effect, that’s how I found out mine. So for example type into the terminal window (replace with the name of your tablet):
xsetwacom set "Wacom Bamboo 2FG 6x8 Pad pad" Button 1 "key ctrl z"
Then try if any of your keys now undos things in Krita. Once you’re sure you’ve found the right tablet name and button names, you can edit the ten brushes script.
Note that xsetwacom only works with your tablet plugged in.
Not sure about Mint but KDE has a Wacom setup tool where you can easily map buttons without command line tools or script files, some other distros also have their own, maybe there’s something for Mint too that is less cumbersome than having to set things up with xwacom, keymap and libinput directly.
Thank you so so so much for the help! I do have xsetwacom installed. Everything ended up working. It took many tries, I kept forgetting the second “pad” in “Pad pad” and accidentally erased the last 3 “”" a couple times. So now I have 5 useless scripts filled in the Ten Scripts and I can’t figure out how to erase them, but I guess if I just make one script that does all the buttons then it doesn’t really matter.
Hi, thanks for the suggestion. I have an extra laptop that is very old and I had put KDE neon on it a year or two ago. I tried the tablet tool and can’t remember, but it wasn’t doing everything I needed it to.
I only have experience with KDE plasma and the Wacom settings tool for it is as officially Wacom as it can get on Linux, not sure what it could possibly missing in terms of button mapping, but I also only have a Intuos and a Cinitq. I also used different distros with most of them setting up the graphics tablet was such a chore that I’m using KDE just because of the easy tablets setup, to be honest.
I’m checking my old files and I still have my scrip from when I was using Xubuntu which also didn’t have a setup tool other than xsetwacom.
I used python for this but not from inside Krita (wich could have permission issues maybe)
This script would map the tablet to a different screen but also set up some button mappings
import subprocess
try:
from screeninfo import get_monitors
except ImportError:
print ('Screeninfo is not installed.')
exit(1)
local_devices = subprocess.Popen(['xsetwacom', '--list', 'devices'], stdout=subprocess.PIPE).communicate()[0].split(b'\n')
devices = {
'Stylus' : None,
'Eraser' : None,
'Cursor' : None,
}
pad = None
if local_devices:
for dev in local_devices:
d = dev.split(b'\t')[0].strip()
if d.endswith(b'Pen stylus'):
devices['Stylus'] = d
elif d.endswith(b'Pen eraser'):
devices['Eraser'] = d
elif d.endswith(b'Pen cursor'):
devices['Cursor'] = d
elif d.endswith(b'Pad pad'):
pad = d
m0 = get_monitors()[0]
res = "%dx%d+%d+%d" % (m0.width, m0.height, m0.x, m0.y)
for key,dev in devices.items():
if dev:
subprocess.Popen(['xsetwacom', '--set', dev,'MapToOutput', res])
subprocess.Popen(['xsetwacom', '--set', dev, 'Area', '0', '4064', '65024', '40640'])
subprocess.Popen(['notify-send', 'Wacom Tablet', '%s maped to screen 1.' % key, '-t', '3000' ])
else:
subprocess.Popen(['notify-send', 'Wacom Tablet', 'No %s device found.' % key, '-t', '3000' ])
# button mappings
if pad:
subprocess.Popen(['xsetwacom', '--set', pad ,'Button', '2', 'key tab'])
subprocess.Popen(['xsetwacom', '--set', pad ,'Button', '3', 'key shift'])
subprocess.Popen(['xsetwacom', '--set', pad ,'Button', '8', 'key ctrl'])
subprocess.Popen(['xsetwacom', '--set', pad ,'Button', '9', 'key alt'])
# 4, 5, 6, and 7 are reserved vor wertical and orizontal scolling
#button 1 is the middle button of scoll ring
subprocess.Popen(['xsetwacom', '--set', pad ,'Button', '1', 'key 2']) #resets zoom in Kirta
subprocess.Popen(['xsetwacom', '--set', pad ,'Button', '10', 'key ctrl z'])
subprocess.Popen(['xsetwacom', '--set', pad ,'Button', '11', 'key ctrl shift z'])
It wasn’t executed by Krita but my local python, I set a global system shortcut to execute it (or it started when I logged in, I don’t remember). Hope you can maybe take something useful from my old stuff.
I can’t really remember how I figured out the numbers for the buttons, I think I used a command line tool that just output every button press it got from whatever device was sending them.
Thank you all for the suggestions, options & fixes, it all worked out really well. But does anybody know how to erase scripts in the Ten Scripts? I probably don’t need to cuz I haven’t really used that feature until now, but it would be nice to know how to do that in case I do end up using more scripts. Thanks so much!
Everything has mostly worked well. But, one more quick question, what gets used in a python script for left and right arrows? I tried searching online and tried a few options, but they wouldn’t work for previous/next frame. Also, is there a way to delete old scripts from 10 Scripts?