I am running Ubuntu 16.04 LTS and I recently got my HUION H420 Graphics Tablet. I have two monitors and the graphics tablet spans both of them however I would like to have it limited to only my main monitor. I haven't a clue where to start. Thanks in advance!
Expanding on this post: HUION H610 Tablet
I'll provide a nice little script for the HUION H420 at the bottom that you can create.
To determine your monitors you can run the command:
Out put should look like:
Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 16384 x 16384 DVI-I-0 disconnected (normal left inverted right x axis y axis) DVI-I-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 477mm x 268mm 1920x1080 60.00*+ 1680x1050 59.95 1600x1200 60.00 1600x900 60.00 1440x900 59.89 1400x1050 59.98 1280x1024 75.02 60.02 HDMI-0 disconnected (normal left inverted right x axis y axis) DP-0 disconnected (normal left inverted right x axis y axis) DVI-D-0 disconnected (normal left inverted right x axis y axis) DP-1 disconnected (normal left inverted right x axis y axis)
The DVI-I-1 connected primary 1920x1080+0+0 is the line we are interested in, specifically the DVI-I-1
One more piace of information is needed, the id number of the stylus. This can be found by running the command
In my case it returns:
↳ HUION H420 Pen stylus id=20 [slave pointer (2)] ↳ HUION H420 Pad pad id=21 [slave pointer (2)]
To get the tablet to work on only that monitor you can run the command:
xinput map-to-output 20 DVI-I-1
To wrap this in a script with buttons you can create a file with your favorite text editor,
tablet.sh that looks like:
#!/bin/sh #Change DVI-I-1 to what monitor you want from running command: xrandr MONITOR="DVI-I-1" #undo xsetwacom --set 'HUION H420 Pad pad' Button 1 "key +ctrl +z -z -ctrl" #define next 2 however you like, I have mine mapped for erase in krita xsetwacom --set 'HUION H420 Pad pad' Button 2 "key e" xsetwacom --set 'HUION H420 Pad pad' Button 3 "key h" ID_STYLUS=`xinput | grep "Pen stylus" | cut -f 2 | cut -c 4-5` xinput map-to-output $ID_STYLUS $MONITOR exit 0
chmod +x tablet.sh and then run the command
If using the script, the
MONITOR variable needs to be changed, and you can change what you want the buttons to do.
There is a project that actually has a gui for the monitor and drawing tablet setup. http://wenhsinjen.github.io/ptxconf/
The above solution did not work for me (but it was really close). I had to change this line
ID_STYLUS=`xinput | grep "Pen stylus" | cut -f 2 | cut -c 4-5`
ID_STYLUS=$(xinput | grep "Pen stylus" | cut -f 2 | cut -c 4-5)
That fixed it.
The script also failed because my monitor was VGA-2 when I wrote the script, but when I restarted my machine, the same monitor was assigned to VGA-1. I replaced this:
MONITOR= $(xrandr | grep "VGA" | grep -w "connected" | cut -c 1-5)
As of 18.10 this can be configured in the Ubuntu Settings.
Open Settings through the upper right menu:
and go to "Devices". Chose the "Wacom Tablet" entry in the left column and choose the "Table" button in the top row.
Check the "Map to single monitor" checkbox and select the monitor you want to use in the drop down box. Here I have a 19" monitor connected with DisplayPort.