Scenario is, bind my Wacom Bamboo to my second monitor and my mouse to the first monitor. The binding for Wacom Bamboo works perfect with the settings for the tablet. But how can I bind my mouse to the other monitor?
My current steps:
Bind the Wacom Bamboo to my second monitor
Configure two independent pointers
With plugged Wacom Bamboo and my mouse,
xinput --list
shows~ xinput list ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ Logitech G9x Laser Mouse id=8 [slave pointer (2)] ⎜ ↳ Logitech G9x Laser Mouse id=9 [slave pointer (2)] ⎜ ↳ Razer Razer BlackWidow Ultimate id=13 [slave pointer (2)] ⎜ ↳ Razer Razer BlackWidow Ultimate id=14 [slave pointer (2)] ⎜ ↳ Wacom Bamboo Pen stylus id=10 [slave pointer (2)] ⎜ ↳ Wacom Bamboo Pen eraser id=11 [slave pointer (2)] ⎜ ↳ Wacom Bamboo Pen cursor id=15 [slave pointer (2)] ⎜ ↳ Wacom Bamboo Pad pad id=16 [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)] ↳ Razer Razer BlackWidow Ultimate id=12 [slave keyboard (3)]
Create a new device with
xinput create-master Bamboo
~ xinput list ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ Logitech G9x Laser Mouse id=8 [slave pointer (2)] ⎜ ↳ Logitech G9x Laser Mouse id=9 [slave pointer (2)] ⎜ ↳ Razer Razer BlackWidow Ultimate id=13 [slave pointer (2)] ⎜ ↳ Razer Razer BlackWidow Ultimate id=14 [slave pointer (2)] ⎜ ↳ Wacom Bamboo Pen stylus id=10 [slave pointer (2)] ⎜ ↳ Wacom Bamboo Pen eraser id=11 [slave pointer (2)] ⎜ ↳ Wacom Bamboo Pen cursor id=15 [slave pointer (2)] ⎜ ↳ Wacom Bamboo Pad pad id=16 [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)] ↳ Razer Razer BlackWidow Ultimate id=12 [slave keyboard (3)] ⎡ Bamboo pointer id=17 [master pointer (18)] ⎜ ↳ Bamboo XTEST pointer id=19 [slave pointer (17)] ⎣ Bamboo keyboard id=18 [master keyboard (17)] ↳ Bamboo XTEST keyboard id=20 [slave keyboard (18)]
Re-attach the Wacom Bamboo ids
xinput reattach 10 "Bamboo pointer" xinput reattach 11 "Bamboo pointer" xinput reattach 15 "Bamboo pointer" xinput reattach 16 "Bamboo pointer"
~ xinput list ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ Logitech G9x Laser Mouse id=8 [slave pointer (2)] ⎜ ↳ Logitech G9x Laser Mouse id=9 [slave pointer (2)] ⎜ ↳ Razer Razer BlackWidow Ultimate id=13 [slave pointer (2)] ⎜ ↳ Razer Razer BlackWidow Ultimate id=14 [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)] ↳ Razer Razer BlackWidow Ultimate id=12 [slave keyboard (3)] ⎡ Bamboo pointer id=17 [master pointer (18)] ⎜ ↳ Wacom Bamboo Pen stylus id=10 [slave pointer (17)] ⎜ ↳ Wacom Bamboo Pen eraser id=11 [slave pointer (17)] ⎜ ↳ Wacom Bamboo Pen cursor id=15 [slave pointer (17)] ⎜ ↳ Wacom Bamboo Pad pad id=16 [slave pointer (17)] ⎜ ↳ Bamboo XTEST pointer id=19 [slave pointer (17)] ⎣ Bamboo keyboard id=18 [master keyboard (17)] ↳ Bamboo XTEST keyboard id=20 [slave keyboard (18)]
About the answer
The answer below might need some additional editing. To create two separate mice, I followed the steps, mentioned in your question. It did work, but my "normal" mouse had some issues afterwards. Left-click did not work in some situations.
Since you do not mention the side- effect in your question, I assume it has to do with hardware- specific conflicting functionality of both mice I connected.
The good news is that
xdotool
apparently only "sees" the coordinates of the "main" mouse, which makes it possible to lock up the cursor in one of the screens.Two scripts
Below two scripts:
1. Script to lock the cursor into one screen, in a dual monitor setup
to use
The script uses
xdotool
:Copy the script into an empty file, save it as
lock_cursor.py
Run it with the screen (
left
orright
) as argument, by either:or
2. Script to automate the setup of two independent mice
This might be a tricky one, since I don't own a Wacom Bamboo, and I could not do a "final test" in a live situation. With my ordinary second mouse, it worked fine however (be it with different id- strings).
If it also works fine in your situation, both script could be merged to run in one call; the script below only takes action if the double- mice setup was not yet performed.
To use
Simply copy the script into an empty file, save it as
setup_bamboo.py
, run it by the command:Notes
I could not find another way to lock the mouse to one screen but to use
xdotool
. The (first) script therefore locks up the mouse with the help ofxdotool
. Since it runs in a periodic loop, the mouse position is corrected if it trespasses the screen's limit. The consequence is that, although effectively it works fine, you will still notice a cosmetic difference with a "hard" fence.I spent some time trying to reduce the effect, "smartly" increasing the loop speed whenever the mouse is near the screen's limit, or even making it dependent on the direction the mouse moves into. In the end however I came to the conclusion that the gained improvement is minimal, and simplicity of coding should be preferred.