Ubuntu – Show *realtime* mouse cursor coordinates? (Cursor mod / overlay) Also, copy to clipboard


I'm looking for a solution that would display the current mouse cursor coordinates in realtime (i.e. NOT xdotool and NOT xev).

I need to move the mouse to a certain position, then press Alt-Tab to flip to another window and record the coordinates there. (This would not move the mouse, so the coordinate display would stay the same).

There's a Windows program that works BEAUTIFULLY for this purpose – http://download.cnet.com/Cursor-Position/3000-2383_4-75449858.html?tag=mncol;1

…but it doesn't even start up in Wine.

Alternately, instead of displaying the coordinates, if this solution could copy the coordinates (in XXX,YYY format) to the clipboard, upon pressing a hotkey, that would be even better.

Any suggestions would be much appreciated!

P.S. I'm running Ubuntu 12.04 LTS.

Best Answer

Spartan solution: you can show the coordinates in real-time with xdotool if you create a bash script. Just execute this in a new Terminal:

while true; do xdotool getmouselocation; sleep 0.2; clear; done

Change the value after sleep to make it more or less "real-time". This requires bash, the default user shell in Ubuntu.

Better solution: if you have admin rights, install watch (sudo apt-get install watch), and then execute this in a new Terminal:

watch -ptn 0 "xdotool getmouselocation"

It uses xdotool but does not require bash.

Thank you b_laoshi for your suggestion!

Related Question