Lock Graphic Tablet to one screen on Linux

Nicola Landro
3 min readMay 8, 2020

I use an economic Huion H420 graphic tablet without screen, on my Linux Mint laptop, but normally I use two screen. Up to now I use very often a display for the call application and other display for others: for example a board in wich all call partecipant can explain yourself by drawing.

Huion H420

The problem

My graphic tablet is too small (7’’) and I have a very old 4:3 screen so the surface for drawing is not optimized. So I prefer to lock my tablet to one screen.

Get informations about monitors (outputs)

At first we should know what monito we have and select the monitor in wich we want lock the graphic tablet.

$ xrandr
Screen 0: minimum 8 x 8, current 2646 x 1024, maximum 32767 x 32767
LVDS1 connected primary 1366x768+0+0 (normal left inverted right x axis y axis) 309mm x 174mm
1366x768 59.99*+ 40.00
1360x768 59.80 59.96
1280x720 60.00
1024x768 85.00 75.03 70.07 60.00
1024x768i 86.96
1024x576 60.00
832x624 74.55
960x540 60.00
800x600 85.14 72.19 75.00 60.32 56.25
864x486 60.00
640x480 85.01 72.81 75.00 59.94
720x405 60.00
720x400 85.04
680x384 60.00
640x400 85.08
632x395 108.01
640x360 60.00
640x350 85.08
504x378 80.97
248x155 113.26
DP1 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
DP3 disconnected (normal left inverted right x axis y axis)
HDMI1 connected 1280x1024+1366+0 (normal left inverted right x axis y axis) 338mm x 270mm
1280x1024 60.02*+ 75.02
1152x864 75.00
1024x768 75.03 60.00
800x600 75.00 60.32
640x480 75.00 59.94
720x400 70.08
HDMI2 disconnected (normal left inverted right x axis y axis)
HDMI3 disconnected (normal left inverted right x axis y axis)
VGA1 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)

I want select the screen of my laptop not the external “HDMI1”. So I select the laptop screen with name “LVDS1”.

Get information about graphic tablet (inputs)

After we can know the name of all our input preriferics in order to select wich we want to lock at the selected screen.

$ xinput
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ AlpsPS/2 ALPS GlidePoint id=12 [slave pointer (2)]
⎜ ↳ HUION H420 Consumer Control id=14 [slave pointer (2)]
⎜ ↳ HUION H420 Pen id=17 [slave pointer (2)]
⎜ ↳ HUION H420 Mouse id=18 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Power Button id=8 [slave keyboard (3)]
↳ Sleep Button id=9 [slave keyboard (3)]
↳ Dell WMI hotkeys id=10 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=11 [slave keyboard (3)]
↳ HUION H420 Keyboard id=13 [slave keyboard (3)]
↳ HUION H420 System Control id=15 [slave keyboard (3)]
↳ HUION H420 Pad id=16 [slave keyboard (3)]

I select my graphic tablet: “HUION H420 Pen”.

Lock it at the screen

At the end we select “LVDS1” screen and “HUION H420 Pen” using the command:

$ xinput map-to-output "HUION H420 Pen" "LVDS1"

After this command my graphic tablet start to work only inside my laptop display. But obviously if we plug out and plugin it again this effect end. If we want that this is the default we can scedule some script that detect when our graphing tablet is pluged in and execute this command.

Conclusions

In this situation I need to use only one screen because my graphic tablet is not enought large. But in general I think that with two screen with same ration and a bigest graphic tablet I do not need It as in my situation.

Drawing during explanation is a very good manner to explain our ideas in a more explanable way so all of us should have a graphics tablet.

--

--

Nicola Landro

Linux user and Open Source fun. Deep learning PhD. , Full stack web developer, Mobile developer, cloud engineer and Musitian.