You are not logged in.

#1 2026-02-06 20:48:03

PGComai
Member
Registered: 2026-02-06
Posts: 1

How to check if any application is currently grabbing the cursor? X11

X11 and KDE Plasma

I'll start by stating my end goal. I stream using an overlay build in Godot, which handles screen capture but does not capture (record) the cursor. To remedy this, I track the cursor position and place my own cursor there in-engine. This works until the cursor is grabbed, as in the way an fps game will grab and hide your cursor. Godot detects the location of the cursor as being in the center (roughly) of whichever window has grabbed it, but it cannot detect whether or not the cursor is in the grabbed state. I want to do this so I can hide my fake cursor in accordance with the real one.

Things I have tried so far:

  • Using Godot's OS.execute() and OS.execute_with_pipe() functions to run stuff like

    xdotool key "XF86LogGrabInfo"

    and then

    cat /var/log/Xorg.0.log

    to no avail. Godot does not seem to be able to read certain directories in /var, including /var/log. I am able to read hardware temps in /sys through the same method.

  • Running a script through cron that copies the Xorg.0.log file somewhere Godot can read it, but I need to be checking for grabs more often than that allows, and I haven't even confirmed that I can get the info I need from that log file.

  • Using xprop to examine window properties. There doesn't seem to be a property that changes according to whether or not my cursor is grabbed.

I have asked the Godot forum here but it seems like the solution is more likely to exist outside Godot.

I would appreciate any advice.

Offline

#2 2026-02-06 21:39:01

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 72,876

Re: How to check if any application is currently grabbing the cursor? X11

You seems to be more interested in the cursor shape than the grabbing state?
https://stackoverflow.com/questions/179 … rsor-image

Offline

Board footer

Powered by FluxBB