technonaturalist

image link to hive image link to ko-fi

Setting up Wacom Cintiq 12WX on Ubuntu Studio 14.04

posted on: Wednesday, 26 November 2014 @ 10:23pm in
tagged

And on goes the love/hate relationship with Linux. Setting up my Cintiq is one of the things that makes me really loathe it and want to go jumping back onto my iMac and ignore the possibility of art on Linux forever. My first attempt was an abysmal fail (I blew up Unity and had to spend a bit of time fixing it and it never completely recovered, and due to the nature of the child who owned that particular machine it ended up with Win7 on it). If I didn’t need a Linux server for web dev (which is why I got the laptop) I would have just bought a MacBook.

Don’t care about the rambling documentation? No worries, just copy/paste the script. You may need to change some button assignments for your setup.

This is probably not necessary but first I grabbed latest Nvidia drivers.

sudo add-apt-repository ppa:xorg-edgers/ppa -y sudo apt-get update sudo apt-get install nvidia-340

340 was the latest at the time of writing. Not sure if I could have got it with nvidia-current and didn’t think to try at the time.

Reboot (I had to use the terminal because Ubuntu decided it needed to do some other updates directly before I installed the nvidia drivers and after I installed the nvidia drivers Cinnamon went a ittle glitchy on me but went back to normal (as far as I can tell) after reboot.

In Terminal type: xrandr

Which should output something like:

Screen 0: minimum 8 x 8, current 3200 x 2600, maximum 32767 x 32767 
eDP1 connected primary 3200x1800+0+0 (normal left inverted right x axis y axis) 293mm x 165mm 
    3200x1800   60.0*   +   48.0 
    2048x1536   60.0 
    1920x1440   60.0 
    1856x1392   60.0 
    1792x1344   60.0 1
    920x1200    60.0 
    1920x1080   59.9 
    1600x1200   60.0 
    1680x1050   60.0        59.9 
    1600x1024   60.2 
    1400x1050   60.0 
    1280x1024   60.0 
    1440x900    59.9 
    1280x960    60.0 
    1360x768    59.8        60.0 
    1152x864    60.0 
    1024x768    60.0 
    800x600     60.3        56.2 
    640x480     59.9 
DP1 connected 1280x800+851+1800 (normal left inverted right x axis y axis) 261mm x 163mm 
    1280x800    59.8*   +   
    1024x768    75.1    70.1    60.0 
    832x624     74.6 
    800x600     72.2    75.0    60.3 
    640x480     75.0    60.0 
    720x400     70.1 
HDMI1 disconnected (normal left inverted right x axis y axis) 
VGA1 disconnected (normal left inverted right x axis y axis) 
VIRTUAL1 disconnected (normal left inverted right x axis y axis)

In my case here eDP1 is the laptop screen and DP1 is the Cintiq. To see what the attached Wacom devices are called do:

xsetwacom --list devices

The Cintiq is the only Wacom device I have attached to the laptop and the output was:

Wacom Cintiq 12WX stylus        id: 11  type: STYLUS 
Wacom Cintiq 12WX eraser        id: 15  type: ERASER 
Wacom Cintiq 12WX pad           id: 16  type: PAD

Now we need a bash script (so the whole bloody thing wouldn’t have to be rethingied because I had the audacity to hotplug the Cintiq or log out or reboot etc).

So we fire up gedit (or whatever text editor of choice) and shove this in:

xsetwacom set "Wacom Cintiq 12WX stylus" MapToOutput DP1 
xsetwacom set "Wacom Cintiq 12WX eraser" MapToOutput DP1

And that’s basic setup done. The pen now maps properly on the Cintiq screen and can be calibrated with the GUI tools.

I tried to switch right click and middle click on my side switch (by default the lower switch is middle click and the upper switch is right click, I like that the other way round) in the GUI but despite changing all available pens the settings wouldn’t take for some reason. A quick trawl around the internet seemed to suggest that the mouse clicks were simply numbered 1-3, where 1 was left click, 2 was middle click and 3 for right click. I did xsetwacom set "Wacom Cintiq 12WX pad" Button N "key N" where N is a number to find out which button was which (nib is 1, lower switch is 2, higher switch is 3). So to get the stylus the way I wanted:

xsetwacom set "Wacom Cintiq 12WX stylus" Button 2 3 
xsetwacom set "Wacom Cintiq 12WX stylus" Button 3 2

I prefer having contact rather than hovering when I’m doing anything so the default behaviour (where if you right click you can hover over the tablet while doing whatever) was doing my head in a bit (not that that was hard by this point). After reading this thread I knew which parameter I needed to hack modify this time:

xsetwacom set "Wacom Cintiq 12WX stylus" TabletPCButton on

Much more betterer for fyn! (It’s the little things :)

The expresskeys turned out to be a little bit strange as the buttons were not mapped how I expected. There are 10 expresskeys, 5 on each side, and I expected 1-5 to be on the left adn 6-10 to be on the right. What actually happened after I did the above trick to find out which button was which was this:

LEFT SIDE Top horizontal button: Button 13 Long vertical button: Button 3 Short top vertical button: Button 1 Short bottom vertical button: Button 2 Bottom horizontal button: Button 8

RIGHT SIDE Top horizontal button: Button 14 Short top vertical button: Button 9 Short bottom vertical button: Button 0 (I meant 10 but used 0) Long vertical button: Button 11 Bottom horizontal button: Button 12

WTF mate.

To find the supported modifiers you can do: xsetwacom --list modifiers

which returns something like:

20 modifiers are supported: 
    ctrl 
    ctl 
    control 
    lctrl 
    rctrl 
    meta 
    lmeta 
    rmeta 
    alt 
    lalt 
    ralt 
    shift 
    lshift 
    rshift 
    super 
    lsuper 
    rsuper 
    hyper 
    lhyper 
    rhyper 
81 specialkeys are supported: 
    [...]
    (truncated during migration for being excessive)

I generally use modifers on the right side, save, undo/redo and move through layers on the left side, though the move layer keys seem to be different depending on the app so I tend to set them at that level. I also use the right rouch strip for zoom and the left touch strip for brush size.

xsetwacom set "Wacom Cintiq 12WX pad" Button 3 "key shift" 
xsetwacom set "Wacom Cintiq 12WX pad" Button 1 "key ctrl" 
xsetwacom set "Wacom Cintiq 12WX pad" Button 2 "key alt" 
xsetwacom set "Wacom Cintiq 12WX pad" Button 8 "key +tab" 
xsetwacom set "Wacom Cintiq 12WX pad" Button 14 "key +ctrl" "key +s" 
xsetwacom set "Wacom Cintiq 12WX pad" Button 9 "key +ctrl" "key +z" 
xsetwacom set "Wacom Cintiq 12WX pad" Button 10 "key +shift" "key +ctrl" "key +z" 
xsetwacom set "Wacom Cintiq 12WX pad" StripRightUp "key [" 
xsetwacom set "Wacom Cintiq 12WX pad" StripRightDown "key ]"

I have no idea why some needed the + and others didn’t or didn’t work with the +.

The unassigned button on the top left is usually my switch screen button but I haven’t figured out how to do that one yet.

Save the script (I named mine wacom-settings.sh coz I’m so imaginative). Go into wherever you saved it, select the script, press ctrl+I (or right click and go properties if that feels too Mac for you), go to the Permissions tab and check the box that says “Allow executing file as program”, then sudo mv ~/wacom-settings.sh /usr/local/bin/wacom-settings.sh. After that go to System Settings --> Startup Applications and add the script to the Startup items.

wacom-settings-script

Want the whole shebang? Here’s a thing to copy/paste, though the DP1 part and the expresskey assignments may need to be changed for your setup.

#!/bin/bash 

# maps the stylus and eraser to the Cintiq screen 
xsetwacom set "Wacom Cintiq 12WX stylus" MapToOutput DP1 
xsetwacom set "Wacom Cintiq 12WX eraser" MapToOutput DP1 

# setting right and middle click the way I want 
xsetwacom set "Wacom Cintiq 12WX stylus" Button 2 3 
xsetwacom set "Wacom Cintiq 12WX stylus" Button 3 2 

# require nib touch for right and middle click 
xsetwacom set "Wacom Cintiq 12WX stylus" TabletPCButton on 

# setting modifier keys 
xsetwacom set "Wacom Cintiq 12WX pad" Button 3 "key shift" 
xsetwacom set "Wacom Cintiq 12WX pad" Button 1 "key ctrl" 
xsetwacom set "Wacom Cintiq 12WX pad" Button 2 "key alt" 
xsetwacom set "Wacom Cintiq 12WX pad" Button 8 "key +tab" 
xsetwacom set "Wacom Cintiq 12WX pad" Button 14 "key +ctrl" "key +s" 
xsetwacom set "Wacom Cintiq 12WX pad" Button 9 "key +ctrl" "key +z" 
xsetwacom set "Wacom Cintiq 12WX pad" Button 10 "key +shift" "key +ctrl" "key +z" 
xsetwacom set "Wacom Cintiq 12WX pad" StripRightUp "key [" 
xsetwacom set "Wacom Cintiq 12WX pad" StripRightDown "key ]"

References