Last active
December 17, 2022 10:33
-
-
Save koonix/c1d7c7ae68538c56967ce3e4ade5b819 to your computer and use it in GitHub Desktop.
Detect if the pointer is on the root window (background) on Linux.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# this script return true if the pointer is on the root window. | |
# requires xorg-xwininfo and xdotool. | |
rootwin=$(xwininfo -root | grep -Po 'Window id: \K\S+') | |
currentwin=$(printf '0x%x\n' "$(xdotool getmouselocation | cut -d: -f5)") | |
[ -n "$currentwin" ] && [ "$currentwin" = "$rootwin" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment