您可以从以下命令获取信息(以及更多信息):
xprop -id <window_id>
要获得您专门寻找的东西:
xprop -id 0x04c00010 | grep "_NET_WM_STATE(ATOM)"
输出将如下所示:
_NET_WM_STATE(ATOM) = _NET_WM_STATE_MAXIMIZED_HORZ, _NET_WM_STATE_MAXIMIZED_VERT, _NET_WM_STATE_HIDDEN
在最大化(h + v)并同时最小化的窗口上
_NET_WM_STATE(ATOM) =
(或完全没有输出)(如果没有)。
当然,可以使用各种语言来使用Wnck,就像下面的python片段中一样。(摘自window-shuffler的片段)。片段输出一个列表,显示窗口名称+或True
或False
(最小化)。
#!/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())
输出看起来像:
Wnck.Window - Classes - Wnck 3.0 - Mozilla Firefox , True
Postvak IN - [email protected] - Mozilla Thunderbird , True
Showtime , False
settingsexample.vala - Visual Studio Code , False
*Niet-opgeslagen document 1 - gedit , False
desktop_weather , False
Tilix: Standaard , False
xprop
将相等地处理十六进制(如从的输出wmctrl
)和十进制(如从的输出xdotool
)id,例如,使用以下任何一种:
xprop -id 111371626
或者
xprop -id 0x06a3656a
方法在Wayland上不起作用!
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句