I know I can get the position of the mouse pointer by executing xdotool getmouselocation
. What I need is program that will run and let me know the position where the mouse pointer clicks.
How to get mouse click position
mousex11
Related Solutions
Personally, I found it easier to leave it the way you currently have it, especially with switching GIMP to single-window mode. But I only randomly play with my Wacom tablet, not use it seriously. That said:
Don't affect the pointer
You just need to use xinput
to float the inputs that you don't want to move the core pointer (mouse pointer).
Here is what xinput looks like with my Bamboo tablet:
anthony@Watt:~$ xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Logitech USB-PS/2 Optical Mouse id=9 [slave pointer (2)]
⎜ ↳ Wacom Bamboo 16FG 6x8 Pen stylus id=11 [slave pointer (2)]
⎜ ↳ Wacom Bamboo 16FG 6x8 Finger touch id=12 [slave pointer (2)]
⎜ ↳ Wacom Bamboo 16FG 6x8 Pen eraser id=14 [slave pointer (2)]
⎜ ↳ Wacom Bamboo 16FG 6x8 Finger pad id=15 [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)]
↳ Power Button id=8 [slave keyboard (3)]
↳ USB-TMU-V3 id=10 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=13 [slave keyboard (3)]
As you can see, the Wacom tablet shows up as a bunch of different pointer devices. The 'pen stylus' and 'pen eraser' are the two from the pen; 'finger touch' is using it as a touchpad; 'finger pad' is the mouse-like buttons on the tablet itself (not the pen).
To float one, just use xinput float «id»
. E.g., xinput float 11; xinput float 14
would make the pen (both stylus and eraser) no longer move the mouse pointer.
Next, you'll have to go to GIMP's Preferences, Input Devices, Configure Extended Input Devices and configure GIMP to handle the stylus and eraser. Similarly, you'll have to configure Inkscape, etc.
Multiple Pointers
An alternative thing you can do with xinput
is to create a second (third, etc.) "master", and attach the input devices there. Then you'll have multiple mouse pointers. Not all apps know what to do with this.
anthony@Watt:~$ xinput float 12
anthony@Watt:~$ xinput create-master 2nd
anthony@Watt:~$ xinput list
⋮
⎡ 2nd pointer id=16 [master pointer (17)]
⎜ ↳ 2nd XTEST pointer id=18 [slave pointer (16)]
⎣ 2nd keyboard id=17 [master keyboard (16)]
↳ 2nd XTEST keyboard id=19 [slave keyboard (17)]
⋮
xinput reattach 12 16
Just force the pointer to skip pixels, here's how:
First list input devices:
$ xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ PixArt USB Optical Mouse id=10 [slave pointer (2)]
⎜ ↳ ETPS/2 Elantech Touchpad id=15 [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)]
↳ USB2.0 UVC 2M WebCam id=9 [slave keyboard (3)]
↳ Asus Laptop extra buttons id=13 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=14 [slave keyboard (3)]
↳ USB Keyboard id=11 [slave keyboard (3)]
↳ USB Keyboard id=12 [slave keyboard (3)]
In the example we see the mouse is PixArt USB Optical Mouse
. Next list its properties:
$ xinput list-props "PixArt USB Optical Mouse"
Device 'PixArt USB Optical Mouse':
Device Enabled (140): 1
Coordinate Transformation Matrix (142): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Accel Profile (265): 0
Device Accel Constant Deceleration (266): 1.000000
Device Accel Adaptive Deceleration (267): 1.000000
Device Accel Velocity Scaling (268): 10.000000
Device Product ID (260): 2362, 9488
Device Node (261): "/dev/input/event5"
Evdev Axis Inversion (269): 0, 0
Evdev Axes Swap (271): 0
Axis Labels (272): "Rel X" (150), "Rel Y" (151), "Rel Vert Wheel" (264)
Button Labels (273): "Button Left" (143), "Button Middle" (144), "Button Right" (145), "Button Wheel Up" (146), "Button Wheel Down" (147), "Button Horiz Wheel Left" (148), "Button Horiz Wheel Right" (149)
Evdev Middle Button Emulation (274): 0
Evdev Middle Button Timeout (275): 50
Evdev Third Button Emulation (276): 0
Evdev Third Button Emulation Timeout (277): 1000
Evdev Third Button Emulation Button (278): 3
Evdev Third Button Emulation Threshold (279): 20
Evdev Wheel Emulation (280): 0
Evdev Wheel Emulation Axes (281): 0, 0, 4, 5
Evdev Wheel Emulation Inertia (282): 10
Evdev Wheel Emulation Timeout (283): 200
Evdev Wheel Emulation Button (284): 4
Evdev Drag Lock Buttons (285): 0
By changing "Coordinate Transformation Matrix" property we can increase the pointer speed. Documentation says it is used to calculate a pointer movement. Quoting:
By default, the CTM for every input device in X is the identity matrix. As an example, lets say you touch a touchscreen at point (400, 197) on the screen:
⎡ 1 0 0 ⎤ ⎡ 400 ⎤ ⎡ 400 ⎤ ⎜ 0 1 0 ⎥ · ⎜ 197 ⎥ = ⎜ 197 ⎥ ⎣ 0 0 1 ⎦ ⎣ 1 ⎦ ⎣ 1 ⎦
The X and Y coordinates of the device event are input in the second matrix of the calculation. The result of the calculation is where the X and Y coordinates of the event are mapped to the screen. As shown, the identity matrix maps the device coordinates to the screen coordinates without any changes.
So, we want to increase X and Y values, leaving the rest unchanged. An example from my PC:
$ xinput set-prop "PixArt USB Optical Mouse" "Coordinate Transformation Matrix" 2.4 0 0 0 2.4 0 0 0 1
Play a bit with this until you're satisfied with the speed.
thanks go to Simon Thum from Xorg mailing list for giving a hint about the matrix.
UPD: note, some Windows games running in Wine may start exhibiting odd pointer behavior (e.g. it was noted that crosshair in Counter Strike 1.6 declines down until it stares the floor no matter how you move the mouse), in this case just reset X and Y of CTM back to 1 before running the game.
Best Answer
You can use GNU Xnee to track your mouse events and then grep only mouse key press events. But since mouse click event doesn't contains mouse position you should store it from previous event or execute external command (e.g.
xdotool
) to get current mouse position.Example:
It will grab all left clicks. Change last number in awk command to get other keys (1 - left mouse, 2 - middle mouse, 3 - right mouse) or remove it to grab all of them.
Also event name probably may look different on your system. Just run
$ cnee --record --mouse
to find out it and replace that part in awk command.