我想禁用关闭或最小化我的一个窗口(或者更准确地说,从窗口中删除最小化和关闭按钮)。我试图改变_NET_WM_ALLOWED_ACTIONS
窗口的属性并使用 删除所有允许的操作xprop
。例如,以下是窗口的初始允许操作:
$ xprop -id 0xa80000d WM_NAME _NET_WM_ALLOWED_ACTIONS
WM_NAME(STRING) = "xterm"
_NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_CLOSE, _NET_WM_ACTION_ABOVE, _NET_WM_ACTION_BELOW, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_MOVE, _NET_WM_ACTION_RESIZE, _NET_WM_ACTION_MAXIMIZE_HORZ, _NET_WM_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_SHADE, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_STICK
xprop
尝试删除所有允许的操作似乎在输出中正确反映:
$ xprop -id 0xa80000d -format _NET_WM_ALLOWED_ACTIONS 32a -set _NET_WM_ALLOWED_ACTIONS ""
$ xprop -id 0xa80000d WM_NAME _NET_WM_ALLOWED_ACTIONS
WM_NAME(STRING) = "xterm"
_NET_WM_ALLOWED_ACTIONS(ATOM) =
但一切都没有改变。此外,在最小化另一个窗口后,我看到允许的操作返回到列表中:
$ xprop -id 0xa80000d WM_NAME _NET_WM_ALLOWED_ACTIONS
WM_NAME(STRING) = "xterm"
_NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_CLOSE, _NET_WM_ACTION_ABOVE, _NET_WM_ACTION_BELOW, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_STICK
我在 Xfce 和 KDE、SLES15 和 Ubuntu 20.04 上都尝试过。