So I got a nice shiny new monitor delivered yesterday, and relegated the old one to being my secondary display. With that in mind, I wanted an elegant solution for switching my wacom tablet between the two screens. By default, the tablet area gets stretched over the whole two screens, which is no good as the aspect ratio is all wrong, and even the slightest sideways motion of the pen results in the cursor going zooming across the screen. After a bit of research and fiddling, and more than a little guidance from @thejikz and @DavisSorenson on twitter I’ve finally got things set up how I want, and so I thought I’d write up a post on my findings for anyone else who’s stuck on the subject. Also next time I reinstall or update ubuntu I’ll have something to look up.
Restricting the Tablet to A Single Screen
On Ubuntu 11.04, with recent versions of the wacom tools, this is accomplised via a coordinate transform matrix. I know, not exactly the kind of user friendly terminology you were perhaps hoping for, but once you get the hang of it it’s not to difficult to work out what you need. I won’t explain the process here, as the ubuntu forums have a great thread on the topic with lots of explanation. Scroll to post #8 for a neat explanation for what each component of the matrix should be. Once you have that it’s just a matter of using the following commands.
Find out the device names for your tablet:
xinput --list
Then set the coordinate transform matrix for your device using:
xinput set-prop "Wacom Intuos3 9x12 stylus" --type=float "Coordinate Transformation Matrix" 0.533333 0 0 0 1 0 0 0 1
Switching the device name for the one you got from “xinput –list” and replacing the CTM with whatever yours happens to be. For me the above command restricts my tablet to my left hand monitor. To switch to the right I use:
xinput set-prop "Wacom Intuos3 9x12 stylus" --type=float "Coordinate Transformation Matrix" 0.466666 0 0.533333 0 0.875 0.125 0 0 1
Setting up buttons
With those commands worked out, all I had to do was map them to my tablet buttons. This was done by first creating new keyboard shortcuts using ubuntus regular keyboard shortcuts editor. I just created new shortcuts, that issued the commands above, and mapped them to something reasonably obscure so they wouldn’t conflict with other apps. In my case I chose shift + print screen and shift + pause.
Then I mapped my tablet buttons to activate these keyboard shorcuts as follows:
xsetwacom --set "Wacom Intuos3 9x12 pad" Button 1 "key Shift Pause"
xsetwacom --set "Wacom Intuos3 9x12 pad" Button 3 "key Shift Print"
Finally I created a script that issues these commands at start-up and added it to my start-up applications, so that I get my tablet configured how I like every time I start ubutu. And that’s pretty much it. Not exactly plug and play, but it get’s the job done!

Nice tute Ben. Useful for a newbie to Ubuntu like myself. Do you have any idea how to swap the default right/middle buttons on the pen as I prefer the opposite?
cheers…
Yeah sure:
xsetwacom --get "Wacom Intuos3 9x12 stylus" Button 3Will tell you what say button three is mapped to for your stylus. The buttons 1, 2, 3 correspond to mouse clicks left, middle, right, so to switch buttons two and three just do:
xsetwacom --set "Wacom Intuos3 9x12 stylus" Button 3 2xsetwacom --set "Wacom Intuos3 9x12 stylus" Button 2 3
Obviousy swap the device name for your stylus.
oooh, i have years trying to do this, thanks a lot
Thanks for your useful post! For those with an nvidia card handling their dual desktop with nvidia-settings installed, to save working out the transformation matrix each time, I use awk to pass the output of:
nvidia-settings -q FrontendResolution
# Whole desktop
xinput set-prop “Wacom BambooFun 4×5 stylus” –type=float “Coordinate Transformation Matrix” 1 0 0 0 1 0 0 0 1
# Screen 1
xinput set-prop “Wacom BambooFun 4×5 stylus” –type=float “Coordinate Transformation Matrix” `nvidia-settings -q FrontendResolution | awk ‘/Attribute.*:/{print $7}’ | awk ‘BEGIN{FS=”[,.\n]”; RS=””}{$6=$1/($1+$4); $2 $4 $5; print $6″ 0 0 0 1 0 0 0 1″ }’`
# Screen 2
xinput set-prop “Wacom BambooFun 4×5 stylus” –type=float “Coordinate Transformation Matrix” `nvidia-settings -q FrontendResolution | awk ‘/Attribute.*:/{print $7}’ | awk ‘BEGIN{FS=”[,.\n]”; RS=””}{print $4/($1+$4)” 0 “$1/($1+$4)” 0 1 0 0 0 1″ }’`
Thank you for this post!
I discovered the option “MapToOutput” of xsetwacom.
First I used the command “xrandr” to get the names of my monitors (when both are plugged).
Then I use the names in the xsetwacom command like this :
#! /bin/sh
xsetwacom set “Wacom Intuos3 9×12 eraser” MapToOutput VGA1
xsetwacom set “Wacom Intuos3 9×12 stylus” MapToOutput VGA1
Then I map this script to the ubuntu key, like you explain.
Thanks Ben and co, this sorted me out a treat.
A limitation of the original post is issuing multiple xsetwacom commands so that the eraser can also be mapped.
My setup = Ubuntu 11.04 6×8 Intuos3 two 1280×1024 displays.
I created 4 files as follows in the users home directory:-
wacom-left containing:-
#!/bin/sh
xinput set-prop “Wacom Intuos3 6×8 stylus” –type=float “Coordinate Transformation Matrix” 0.5 0 0 0 1 0 0 0 1
xinput set-prop “Wacom Intuos3 6×8 eraser” –type=float “Coordinate Transformation Matrix” 0.5 0 0 0 1 0 0 0 1
wacom-right containing:-
#!/bin/sh
xinput set-prop “Wacom Intuos3 6×8 stylus” –type=float “Coordinate Transformation Matrix” 0.5 0 0.5 0 1 0 0 0 1
xinput set-prop “Wacom Intuos3 6×8 eraser” –type=float “Coordinate Transformation Matrix” 0.5 0 0.5 0 1 0 0 0 1
wacom-both containing:-
#!/bin/sh
xinput set-prop “Wacom Intuos3 6×8 stylus” –type=float “Coordinate Transformation Matrix” 1 0 0 0 1 0 0 0 1
xinput set-prop “Wacom Intuos3 6×8 eraser” –type=float “Coordinate Transformation Matrix” 1 0 0 0 1 0 0 0 1
I then added the left, both, and right to Shifts of: Print Scr, Scroll Lock, and Pause like in the original post.
N.B. I needed to put in the full path of the command so if user was fred then for command I had to put in:-
/home/fred/wacom-left
To auto associate these keyboard shortcuts with wacom pad buttons as in original post I created another file in the users home dir:-
wacom-buttons containing:-
#!/bin/sh
xsetwacom –set “Wacom Intuos3 6×8 pad” Button 1 “key Shift Pause”
xsetwacom –set “Wacom Intuos3 6×8 pad” Button 3 “key Shift Print”
xsetwacom –set “Wacom Intuos3 6×8 pad” Button 2 “key Shift Scroll_Lock”
I then made all the wacom command files executable:-
chmod u+x ~/wacom-*
Finally added in startup applications wacom-buttons, again taking care to put in the whole path for the wacom-buttons file or use the browse button; ~ didn’t work for me.
Thanks again everyone, very helpful.
@Steven
This looked like a great and clever fix but alas for me using twinview nvidia-settings -q FrontendResolution returns no info.
@Michael
re the great option of MapToOutput was not available to me, see:-
http://ubuntuforums.org/showthread.php?t=1656089
Only in recent git of xf86-input-wacom is this working for proprietary nvidia drivers.
THANK YOU!!!!
Thanks a lot!
here’s what I wrote for the Huion tablet, and it should work similarly for any tablet.
http://pastebin.com/QE8NCkP0
you just edit the script with the names of your adapter ports, and put in the tablet name. I wrote it for my 3 monitor setup.
Nice script, Christopher Barry. I made a similar one that I find a little bit easier to use. It’s a little simpler and there is no need to modify the script to get it to work with your particular tablet or screens. When run with no arguments, it resets your tablet to cover all desktops.
[On the other hand, my script doesn’t have clever functions like your evar which evaluates the contents of a variable as another variable name.]
Great, it works fine for me. But How I can save this settings? This do not work after restart.