Restrict a Drawing Tablet to Single Monitor

This is a short how-to for restricting a drawing tablet (also known as a graphics tablet) to a single screen. When you have 2, 3, or 4 (or more) monitors, input devices might not work exactly how you want them to because of the difference between desktop size and monitor size (when using big desktop or xinerama. As an example, I have 2x22" monitors, each capable of displaying 1680x1050. My desktop size is therefore 3360x1080, and that is what my tablet maps to. The right side of my tablet moves the cursor to the right side of my right monitor, and the left side of my tablet maps to the left side of my left monitor. That would be great if my monitors were borderless and their sides were touching! Unfortunately they aren't even the same brand, so I need my tablet to only work on a single monitor, but still need my trackball to work on both. Without this configuration, my only other option would be to deactivate my second monitor with nvidia-config whenever I want to draw, but I don't see that as a good option.

My tablet is a Genius 8x6" and works well enough, although these instructions should work for when you have both a touchscreen and a normal monitor side by side, or with other brands of tablet, like Wacom. With Wacom tablets, check the Wacom software in the repositories, as you might be able to do this in an easier fashion.

First, I plug in the tablet. Then at a terminal (the "% " is the prompt. Only enter what comes after it!):

% xinput list

which (this time) returned the following:



⎡ Virtual core pointer                   id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer         id=4    [slave  pointer  (2)]
⎜   ↳ Logitech Trackball                 id=9    [slave  pointer  (2)]
⎜   ↳ UC-LOGIC Tablet WP8060U            id=11   [slave  pointer  (2)]
⎜   ↳ UC-LOGIC Tablet WP8060U            id=12   [slave  pointer  (2)]
⎣ Virtual core keyboard                  id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard        id=5    [slave  keyboard (3)]
    ↳ Power Button                       id=6    [slave  keyboard (3)]
    ↳ Power Button                       id=7    [slave  keyboard (3)]
    ↳ Sleep Button                       id=8    [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard       id=10   [slave  keyboard (3)]

As you can see, I have a logitech trackball (best device ever), two inputs for my tablet, and one of those keyboards is my real keyboard. What I need from the output is the id of my tablet.

The other part of the command is creating the transformation for my setup. Thankfully I have 2 equal sized monitors, side by side. What we use for that is a 3x3 grid of numbers called the Coordinate Transformation Matrix. Each number has a use, but only a few are needed. Here's the grid:

 

X Scale0Translate X
0Y ScaleTranslate Y
00Zoom XY

FYI: Scale means size (X is left-right, or horizontal; Y is up-down, or vertical) and Translate means move (with X and Y meaning move horizontal or vertical).

In order to set the default, which is the whole tablet mapped to both monitors (which is stretched in the X axis) use the following command:

% xinput set-prop "12" --type=float "Coordinate Transformation Matrix" 1 0 0 0 1 0 0 0 1

In order to map the tablet to the left monitor, you just have to scale X by whatever percentage you need. My monitors are of equal width, so I'll use 0.5 for X Scale.

% xinput set-prop "12" --type=float "Coordinate Transformation Matrix" 0.5 0 0 0 1 0 0 0 1

If you would rather use the right monitor, keep the X Scale factor of 0.5 and add a Translate X of 0.5

% xinput set-prop "12" --type=float "Coordinate Transformation Matrix" 0.5 0 0.5 0 1 0 0 0 1

Do you have 2 monitors, with one above the other? The following should restrict to the top monitor:

% xinput set-prop "12" --type=float "Coordinate Transformation Matrix" 1 0 0 0 0.5 0 0 0 1

and the following to the bottom one:

% xinput set-prop "12" --type=float "Coordinate Transformation Matrix" 1 0 0 0 0.5 0.5 0 0 1

I'll give 4 more in a row, just in case you're one of the few with 4 monitors. The following four commands will restrict the tablet to the top-left, top-right, bottom-left, and bottom right, respectively.

% xinput set-prop "12" --type=float "Coordinate Transformation Matrix" 0.5 0 0 0 0.5 0 0 0 1
% xinput set-prop "12" --type=float "Coordinate Transformation Matrix" 0.5 0 0.5 0 0.5 0 0 0 1
% xinput set-prop "12" --type=float "Coordinate Transformation Matrix" 0.5 0 0 0 0.5 0.5 0 0 1
% xinput set-prop "12" --type=float "Coordinate Transformation Matrix" 0.5 0 0.5 0 0.5 0.5 0 0 1

I've got one more, based on my need. I now have a 1680x1020 monitor to the left of a 1920x1080. To restrict to the right monitor, I use

% xinput set-prop "13" --type=float "Coordinate Transformation Matrix" 0.533 0 0.467 0 1 0 0 0 1

If you find any errors, or would like to see examples of other restrictions, let me know the dimensions and I'll see if I can get it right. Don't forget to use the correct number after "set-prop" option.

 

 

 

Tags: 

Did you find this post useful? You can leave me a buck or two with the Paypal donate button, support me on Patreon, or consider buying one of the "Suggested Resources" books on the side using my affiliate code (you pay the same price for the book, but I get a small referral fee from Amazon)!

Share This Post