I'd like to be able to display the current location of the pointer on the X display. Is there any application which does this?
-
1I found a solution. There's a package called xdotool that has an application named getmouselocation. It works like this: sconklin@xps-1:~$ xdotool getmouselocation x:1285 y:10 screen:0– sconklinJul 19, 2011 at 21:33
-
4please write that in an actual answer, once the site allows you to.– IsaiahJul 19, 2011 at 22:24
-
I wrote it up as an answer for you (wiki mode to not take undue rep for it).– Ilari KajasteJul 20, 2011 at 7:52
5 Answers
There's a package called xdotool
that has an application named getmouselocation
, available from ubuntu repositories with sudo apt-get install xdotool
. Running the command
xdotool getmouselocation
will output
x:1285 y:10 screen:0
-
17Probably "watch xdotool getmouselocation" is what most people are looking for. Dec 31, 2013 at 12:44
- Install xdotool
Open a terminal and paste this:
while true; do clear; xdotool getmouselocation; sleep 0.1; done
Move the cursor over the screen and you will see live coordinates update on terminal.
-
4
xev
from the command line shows this. Try the following.
xev
Current coordinates are displayed as root:(<x>,<y>)
.
-
6It seems to be
xev
only shows the location when the mouse cursor is pointing at the window whichxev
opens. Jul 20, 2011 at 7:54 -
-
2@kcpr, what? I don't see any
root:(<x>,<y>)
in the terminal window that holds thexev
data. Jan 3, 2016 at 0:04 -
Here's a python script:
#!/usr/bin/env python3
from Xlib import display
import sys
while True:
c = display.Display().screen().root.query_pointer()._data
x = c["root_x"]
y = c["root_y"]
sys.stdout.write(f'{x:04} {y:04}\r')
sys.stdout.flush()
Save it to file myscript.py
, and launch with python3 myscript.py
.
Not a native Linux solution, but if you have Wine installed, Pixie is a free (as in beer) small app that will show you both your cursor's coordinates and the color of the pixel directly underneath it in several formats.