Mapping a drawing tablet to a single monitor

After getting a second monitor, and realizing that the sensitivity of my drawing tablet’s pen was all over the place, I wanted to find a way to map it to a single monitor.

I was able to achieve this with xinput’s map-to-output parameter which takes a device and an output. I ended up writing this small shell script to make the process shorter:

output=`xrandr | grep ' connected' | cut -d' ' -f1 | dmenu -p "Select the monitor to map the tablet to"`
devs=`xinput | grep 'Tablet' | cut -d'=' -f2 | cut -f1`
for dev in $devs ; do
    xinput map-to-output $dev $output

This simple script works for my use case, maybe it will work for you as well.