26

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.

9 Answers 9

45

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: xrandr

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 xinput

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"
PAD_NAME='HUION H420 Pad pad'

#undo
xsetwacom --set "$PAD_NAME" Button 1 "key +ctrl +z -z -ctrl" 

#define next 2 however you like, I have mine mapped for erase in krita
xsetwacom --set "$PAD_NAME" Button 2 "key e"
xsetwacom --set "$PAD_NAME" 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

now chmod +x tablet.sh and then run the command ./tablet.sh

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/

2
  • I prefer this approach (especially the script) because it doesn't depend on using GUI settings, which may be different depending on your window manager. I have ubuntu for example, but use the i3wm, so this command and script based approach works best and is much more portable.
    – Andre
    Jan 22, 2020 at 12:03
  • Had to follow these instructions to make setting the keys work for my Huion HS610 (otherwise not listed under '''xsetwacom list''').
    – Andi Bauer
    Feb 7, 2022 at 15:03
6

As of 18.10 this can be configured in the Ubuntu Settings.

Open Settings through the upper right menu:

enter image description here

and go to "Devices". Chose the "Wacom Tablet" entry in the left column and choose the "Table" button in the top row.

wacom tablet devices entry

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.

display mapping dialog box

4
  • 1
    This doesn't work for the Huion H420, it does not appear in settings as a wacom tablet.
    – Ulincsys
    Jul 10, 2019 at 2:08
  • @johnkieran Perhaps raise an Ubuntu bug issue? Jul 10, 2019 at 13:14
  • Looks good !! But unfortunately I don't find such a menu in Linux Mint..
    – TOPKAT
    May 28, 2021 at 16:38
  • @GLAND_PROPRE Then consider switching to Ubuntu 18.10. May 28, 2021 at 17:32
3

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`

to this:

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='VGA-2'

With

MONITOR= $(xrandr | grep "VGA" | grep -w "connected" | cut -c 1-5)

2

System settings doesn't recognize my Wacom Intuos Tablet. However, the following command lines worked for me

Find the name of the monitor you wish to use for the table using xrandr

$ xrandr
Screen 0: minimum 320 x 200, current 3200 x 900, maximum 16384 x 16384
VGA-1 connected 1600x900+1600+0 ....
HDMI-1 connected primary 1600x900+0+0 ... 

Find the device name of your Wacom Tablet using xsetwacom

$ xsetwacom list devices

Wacom Intuos S Pen stylus           id: 13  type: STYLUS    
Wacom Intuos S Pen eraser           id: 14  type: ERASER    
Wacom Intuos S Pen cursor           id: 15  type: CURSOR    
Wacom Intuos S Pad pad              id: 16  type: PAD

Map the all Wacom devices to your desired monitor.

In my case it is VGA-1.

xsetwacom set 'Wacom Intuos S Pen stylus' MapToOutput VGA-1
xsetwacom set 'Wacom Intuos S Pen eraser' MapToOutput VGA-1
xsetwacom set 'Wacom Intuos S Pen cursor' MapToOutput VGA-1
xsetwacom set 'Wacom Intuos S Pad pad' MapToOutput VGA-1
1

You might want to try running Ubuntu on Wayland instead of Xorg. Wayland provides better support for touch and tablets, so issues like incorrect screen mapping don't occur. To run Ubuntu on Wayland:

  1. During login, click the settings wheel in bottom right corner.
  2. Choose "Ubuntu on Wayland"
  3. Login.
  4. Check that you're running Wayland by typing echo $XDG_SESSION_TYPE in the console.
1
  • Wow, thanks a lot! This solved my issue completely I didn't need at all to change parameters in any input files, save settings for start-up or figure what which is my main screen!
    – NeStack
    Mar 19, 2021 at 12:10
1

Based on the answers given here I have developed a Linux system tray app (in python 3) that allows to select the output monitor from the available monitors.

screenshot

0

To easily change between screens I came up with a few lines of code that let you choose the screen that you want to use by just writing a command (you have to modify the code a bit in order to get it working on your computer):

wacId=$(xsetwacom list devices | grep STYLUS | tr " \t" ":" | tr -s ":" | cut -d ":" -f 7)
alias wacEDP="xsetwacom set $wacId MapToOutput eDP"
alias wacHDMI="xsetwacom set $wacId MapToOutput HDMI-A-0"

You just have to copy these lines at the end of your ~/.bashrc file in order to have the aliases always available when you restart your computer. To have it available the first time you copy it just run the command source ~/.bashrc.

My 2 screens show the name eDP and HDMI-A-0 when I run the command xrandr, so you have to change these names to the ones that appear on your computer when you run this command. You can put as many aliases as you want depending on your number of screens.

Then to change between screens you just have to write the name of the alias that you wrote, for example to change to my hdmi screen I would run the command wacHDMI.

Restarting your computer will reinitialize the wacom settings to use all the displays at once so you will have to run one of the aliases everytime you reboot the system.

0

I wrote a Python script (comments and variables in German) that will allow you to toggle between monitors. I put it on GitHub with instructions. You just drag the two files to your ~/bin file, and then you can set the command to a hotkey. Anyways, if you are interested here is the link.

0

in ubuntu 21.10 this is the new interface. in the settings window search for "wacom"

ubuntu documentation

1
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
    – David
    Nov 2, 2021 at 5:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .