Linux
Raiting:
17

Linux :: two, three, five ... mouse pointers!


I do not know why I may need it, but suddenly I wanted to have two mouse pointers in Linux, after all I already have two mice, one is a wireless mouse and the other is a touchpad one. The idea came at a time when I hooked up a second mouse, namely, a third cursor control device.

I want each mouse to get a cursor, but how do I get it?

Let's see what xinput will tell us:

max 23:20:19 ~ $ xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Logitech USB Receiver id=10 [slave pointer (2)]
⎜ ↳ Logitech USB Receiver id=11 [slave pointer (2)]
⎜ ↳ Genius 2.4G Wireless Mouse id=12 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad 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)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Sleep Button id=8 [slave keyboard (3)]
↳ Villem id=9 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=13 [slave keyboard (3)]
↳ HP WMI hotkeys id=15 [slave keyboard (3)]

Honestly, I do not know why USB whistle from Logitech is displayed twice. I would be grateful if someone tells me why that happens.

Well, let’s get back to our topic, we have only four mice:

Virtual
Logitech
Genius
Touchpad

In order to see the second cursor will create the group:

xinput create-master logitech
Now we have two mouse pointers on the screen, but the second one is still immovable, and all three devices are controlled by the same pointer. Let's say X-server that the Logitech will control the same immovable pointer. To do this, let’s take another look at:

max 23:23:40 ~ $ xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Logitech USB Receiver id=10 [slave pointer (2)]
⎜ ↳ Logitech USB Receiver id=11 [slave pointer (2)]
⎜ ↳ Genius 2.4G Wireless Mouse id=12 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad 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)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Sleep Button id=8 [slave keyboard (3)]
↳ Villem id=9 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=13 [slave keyboard (3)]
↳ HP WMI hotkeys id=15 [slave keyboard (3)]
⎡ logitech pointer id=16 [master pointer (17)]
⎜ ↳ logitech XTEST pointer id=18 [slave pointer (16)]
⎣ logitech keyboard id=17 [master keyboard (16)]
↳ logitech XTEST keyboard id=19 [slave keyboard (17)]
Now we can distinguish two groups of input devices, such as Virtual core and Logitech, but sp far we see that the Logitech device is still a part of the Virtual core group. Let’s correct this situation and attach the device with ID=10 (Logitech) to the group with ID=16 (Logitech)
xinput reattach 10 16
Now the mouse from Logitech controls previously immovable cursor.

Let’s create another group and attach our touchpad to it:

max 23:30:30 ~ $ xinput create-master touchpad
max 23:32:35 ~ $ xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Logitech USB Receiver id=11 [slave pointer (2)]
⎜ ↳ Genius 2.4G Wireless Mouse id=12 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad 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)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Sleep Button id=8 [slave keyboard (3)]
↳ Villem id=9 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=13 [slave keyboard (3)]
↳ HP WMI hotkeys id=15 [slave keyboard (3)]
⎡ logitech pointer id=16 [master pointer (17)]
⎜ ↳ Logitech USB Receiver id=10 [slave pointer (16)]
⎜ ↳ logitech XTEST pointer id=18 [slave pointer (16)]
⎣ logitech keyboard id=17 [master keyboard (16)]
↳ logitech XTEST keyboard id=19 [slave keyboard (17)]
⎡ touchpad pointer id=20 [master pointer (21)]
⎜ ↳ touchpad XTEST pointer id=22 [slave pointer (20)]
⎣ touchpad keyboard id=21 [master keyboard (20)]
↳ touchpad XTEST keyboard id=23 [slave keyboard (21)]
max 23:32:39 ~ $ xinput reattach 14 20
max 23:32:53 ~ $
After that, we see three mouse pointers and each one could be controlled from a separate device!

How can it be useful? I do not know yet. I guess just for fun, however I could proudly say:

Look, I can do that!
Tags: linux, xorg
Pirat 30 march 2014, 21:03
Vote for this post
Bring it to the Main Page
 

Comments

Leave a Reply

B
I
U
S
Help
Avaible tags
  • <b>...</b>highlighting important text on the page in bold
  • <i>..</i>highlighting important text on the page in italic
  • <u>...</u>allocated with tag <u> text shownas underlined
  • <s>...</s>allocated with tag <s> text shown as strikethrough
  • <sup>...</sup>, <sub>...</sub>text in the tag <sup> appears as a superscript, <sub> - subscript
  • <blockquote>...</blockquote>For  highlight citation, use the tag <blockquote>
  • <code lang="lang">...</code>highlighting the program code (supported by bash, cpp, cs, css, xml, html, java, javascript, lisp, lua, php, perl, python, ruby, sql, scala, text)
  • <a href="http://...">...</a>link, specify the desired Internet address in the href attribute
  • <img src="http://..." alt="text" />specify the full path of image in the src attribute