And while I never tried, but I might, because I liked this idea of changing tablet to different portions of the screen. I don’t think it must be that complicated.
For the script itself I have a little experience as my Huion tablet + Digimend drivers made my tablet ‘disappear’ from the Gnome tablet UI. Now at start up a shell script is executed to set my tablet to my screen ratio.
The script is the most simple, here:
#!/bin/sh
xsetwacom -s set "HUION Huion Tablet stylus" Area 0 0 50650 28500
Shell script accept if / else statements, so the script can get the MapToOutput and execute the proper command.
If I’m not mistaken this should work and you wouldn’t even need to change profiles.
You can even do it from within Krita with the Ten Scripts script. Save a Python script like this:
script = """
xsetwacom set "Name of your device" Button 3 "key ctrl z"
xsetwacom set "Name of your device" Button 8 "key e"
xsetwacom set "Name of your device" Button 9 "key shift"
xsetwacom set "Name of your device" Button 1 "key ctrl"
"""
import subprocess
subprocess.run(script, shell=True)
Then go to Tools → Script → Ten Scripts and assign your python script to one of the slots. Then do a new script for a different profile and assign to a different slot.
You can change the keyboard shortcuts via Krita’s usual keyboard settings.
Actually, I’m keeping this setup myself now. Don’t know why I never thought of this.
Thanks vey much, is it possible to use a if else function? Like:
If the output of “xsetwacom get “Wacom Intuos Pro L Pen stylus” Area” is “0 4106 62200 39093” Than do:
xsetwacom set “Wacom Intuos Pro L Pen stylus” area 0 0 62200 43200
xsetwacom set “Wacom Intuos Pro L Pen stylus” maptooutput 2074x1440+220+0
otherwise, do:
xsetwacom set “Wacom Intuos Pro L Pen stylus” area 0 4106 62200 39093
xsetwacom set “Wacom Intuos Pro L Pen stylus” maptooutput 2560x1440+0+0
Then it works like a switch with the same button to the script right?
And because the xsetwacom don’t overwrite ALL THE OTHER kde settings, only the other way, it is possible to set all stuff in one profile via kde settings and use this script afterward as a simple switch.
But i don’t know what i have to do, do i have to fill a variable with the output of the first command, which is then compared? I have never programmed before…
And yeah, if you do the KDE settings first and then run the xsetwacom script, that should work, I believe. Remember to rerun the xsetwacom script if you touch the KDE settings.
The thing is that i use the second setting in the script as the default profile setting in kde. It is just there that the script works like a switch and turns the kde setting back after the second use.
#!/usr/bin/env python3
import subprocess
DEVICE = 'Wacom Intuos Pro L Pen stylus'
value = subprocess.getoutput(f'xsetwacom get "{DEVICE}" Area')
print('Value:', value)
if value == '0 4106 62200 39093':
script = f"""
xsetwacom set "{DEVICE}" area 0 0 62200 43200
xsetwacom set "{DEVICE}" maptooutput 2074x1440+220+0
"""
else:
script = f"""
xsetwacom set "{DEVICE}" area 0 4106 62200 39093
xsetwacom set "{DEVICE}" maptooutput 2560x1440+0+0
"""
print('Script:\n', script)
subprocess.run(script, shell=True)
I couldn’t properly test it with my tablet, but in theory this should work. It’s a python script, so save it as something ending in .py. As a python script, you can either use it from inside Krita or outside of Krita.
The lines starting with “print” are just for information to see what the script is doing. To see the print output, the easiest way without Krita is to give the script executable rights (From the terminal window that would be chmod 755 myscript.py), and then start from the command line:
./myscript.py
Or from within Krita, you can load it/paste it into Scripter (Tools → Scripts → Scripter) and press the run button.
You should do either of these and verify the script works before assigning it to shortcuts.
It works, i’m able to switch between a precicion mode i have set to the canvas and then backward to the whole monitor mapped with just one and the same shortcut! And all other stuff is set in the kde settings easily. Thank you very much!
Now everyone can use it and simply customize the values they want for their tablet and screen!
Now i only have to look into the touch stuff. :sweat_smil
A lot of good info regarding xsetwacom. There is another option (depending on tablet) that I switched out to awhile back. Opentabletdriver is cross platform and has a good gui. It has a ton of settings relating to gaming and other stuff as well and is under good development. Worth a look.
Wacom driver for x11 doesn’t handle touch well. The dev suggested me to use libinput for touch. I created a udev rule to hand of touch to libinput but all it does it makes it a laptop touchpad. And there is no supprt for gestures and two fingure rotate etc on x11 I have not tried wayland because it doesn;t have colour management yet. You can read more about the udev rule here - Graphics tablet - ArchWiki