Setting Up Dual Monitors with a Wacom Tablet on Ubuntu 11.04
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:
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!