2

So basically, I'm trying to write a watchdog script, that checks window titles against a list stored in a file. If the window is fullscreen, the script should do nothing and move on. If the window is NOT fullscreen the script should call wmctrl -r '$title' -b toggle,fullscreen I've been looking through the wmctrl man pages, and there doesn't seem to be a foolproof way to detect if a Window is indeed fullscreen (for exmaple, I could call wmctrl -l -G but if I check against the current screen resolution that doesn't gaurantee the fullscreen flag has been set, just that the window is sized to the full screen resolution)

Is there a decent manner in which to accomplish this conditional check?

1 Answers1

3

Well, I did a bit of digging, it looks like you can grab the state of the fullscreen toggle using xprop pretty easily. Prior to executing wmctrl -r '$title' -b toggle,fullscreen the output of xprop -name '$title' has the variable _NET_WM_STATE(ATOM) = undefined. After executing, that variable reads as follows: _NET_WM_STATE(ATOM) = _NET_WM_STATE_FULLSCREEN

Using this I can easily detect whether or not the window is already fullscreen so I don't have to guess.