@rjt not what you are asking, but I copy/pasted a small utility from stackoverflow, that moves the mouse pointer (using XWarpPointer) by a specified relative delta_x/delta_y: https://code.mathr.co.uk/puzzle/blob/ddda4527e04476cc1698ab09dc8aba159beee3c1:/warp.c
Warning: no error checking, if less than two arguments are provided then it may crash with out of bounds memory read. The fix is one line, something like ```if (! (argc > 2)) return 1;``` at the start of `main()`.
You can move the mouse cursor to the corners of the screen by specifying +/- huge numbers. From the top left corner you can move to the center of the screen by parsing the resolution from the output of `xrandr` (or you could hardcode values if you know your screen).
This solves the problem of "put mouse cursor in known position", not "find position of mouse cursor".
@mathr Thanks! That gives me some ideas if I wanna sit down and try to script something.
@rjt Don't know what window manager you're using, but https://askubuntu.com/questions/986688/easy-way-to-quickly-locate-the-mouse-pointer may or may not contain the relevant setting for you.
gsettings set org.gnome.settings-daemon.peripherals.mouse locate-pointer true
Use "false" to turn this off. This option should be in GNOME tweak tool too (Keyboard & Mouse section).
In Compiz: "Show cursor" plugin ("compiz-plugins-extra")
In KDE: default on, combination is Ctrl+Meta
An instance for people that make stuff. Doesn't matter if you DIY, work on your car, your garden, do art, cook, make music, or anything else. Toot about it here