Retrieve info on the window state
You can get the info (and a lot more) from the command:
xprop -id <window_id>
To get what you are specifically looking for:
xprop -id 0x04c00010 | grep "_NET_WM_STATE(ATOM)"
The output will look like:
_NET_WM_STATE(ATOM) = _NET_WM_STATE_MAXIMIZED_HORZ, _NET_WM_STATE_MAXIMIZED_VERT, _NET_WM_STATE_HIDDEN
on a window that is maximized (h + v) and minimized at the same time, or just
_NET_WM_STATE(ATOM) =
(or no output at all) if none of those is the case.
More fun
Of course, using various languages, you can use Wnck, like in the python snippet below. (snippet from window-shuffler). The snippet outputs a list, showing the window name + either True
or False
(minimized).
#!/usr/bin/env python3
import gi
gi.require_version('Wnck', '3.0')
from gi.repository import Wnck
def get_winlist(scr=None, selecttype=None):
"""
get the window list. possible args: screen, select_type, in case it is
already fetched elsewhere. select type is optional, to fetch only
specific window types.
"""
if not scr:
scr = Wnck.Screen.get_default()
scr.force_update()
windows = scr.get_windows()
if selecttype:
windows = [w for w in windows if check_windowtype(w, selecttype)]
return windows
wlist = get_winlist()
for w in wlist:
print(w.get_name(), ",", w.is_maximized())
Output looks like:
Wnck.Window - Classes - Wnck 3.0 - Mozilla Firefox , True
Postvak IN - vlijm@planet.nl - Mozilla Thunderbird , True
Showtime , False
settingsexample.vala - Visual Studio Code , False
*Niet-opgeslagen document 1 - gedit , False
desktop_weather , False
Tilix: Standaard , False
N.B.
devilspie
which is designed to do exactly this kind of window work. So no need to recode, just configure – Ciprian Tomoiagă Apr 08 '19 at 10:08