scripts:i3:map_wacom_tablet_to_single_display

Map Wacom (or other) Graphics Tablet to One Display

By default, connecting a graphic tablet such as a Wacom will map the full resolution of the X11 window to the tablet. If you have more then one display, it will mess with the aspect ratio.

The solution is simple. If you are on X11, this can be done with xinput. You can also use xsetwacom with libinput.

First check the list of input devices by doing

xinput

This will return the list of input devices. You want to search for the one that is the pen or stylus for your tablet, as it is the one that send the mouse inputs. Copy the id of this device.

Since most devices have the work stylus, you can just grep for it

xinput list | grep "stylus"

Then, check the display name you want to map it to by running

xrandr

or using a display manager of your choice.

Finally, to map the input to the display, run the following

xinput map-to-output <input> <display>

For example, to map input device 10 to display DVI-D-0

xinput map-to-output 10 DVI-D-0

Alternatively, on some systems, you can use xsetwacom to achieve the same thing if you don't use libinput.

xsetwacom set 10 MapToOutput DVI-D-0

2021 update: automated version

For my Intuos tablet, I figured I can automate this instead of using my eyes to find the id from xinput.

Here is the jank result that somehow works. Parameter 1 is to map to DisplayPort-0 or DisplayPort-1, my 2 monitors.

input=$(xinput list | grep stylus | cut -c 55-57);
echo "Wacom is on $input";
echo "Mapping to DisplayPort-$1";
xsetwacom set $input MapToOutput DisplayPort-$1

I basically cut the result of xinput through hardcoded columns 55-57 since that's where the id always is for me.

Then, I feed that to xsetwacom, with the monitor set by my parameter. Make it a script or bash function.

2022 update

Use sway instead.

  • scripts/i3/map_wacom_tablet_to_single_display.txt
  • Last modified: 2023-02-17 03:35
  • by Tony