Are you ready to write your own script? If so, I found three tools that, if used together, can do the job for you.
First use xprop to get the PID of the window you clicked on.
Then use xwininfo to get the size and location information of the window based on its process id.
Finally, use xdotool to calculate the center position of the specified window and move the cursor to that exact position.
Hope this helps. I don't have enough time to write now to write a script (sorry), but that should be enough for you to get started.
EDIT: based on your comment, you want to stay in GNOME js. It’s completely clear. You can call xdotool (which is the most efficient way to move the cursor on the screen) from within GNOME js, using something like:
const Util = imports.misc.util; Util.spawn(['/bin/bash', '-c', "xrandr --query | awk 'something'"])
This code was found in this thread.
Joseph Farah
source share