我正在尝试使用 Devilspie2 来检测 Firefox 窗口何时打开,并在打开时删除其窗口装饰。
这有效,但前提是在启动 Devilspie2 时窗口已经打开;在 Devilspie2 运行时打开新窗口不会执行任何操作。
我的理论是,Firefox 在打开后会迅速更改其应用程序名称;问题是我无法找到一种方法来足够快地监视应用程序的名称以找出其打开时的初始名称;使用下面包含的调试语句,它只显示新 Firefox 窗口的一个“应用程序名称”,它与我的脚本中的内容相匹配。
这是我的 Devilspie2 脚本的样子:
-- Matching by application name:
if (get_application_name()=="Firefox") then
undecorate_window();
end
-- Matching by windows that end in "Mozilla Firefox" :
if (End=='' or string.sub(get_window_name(),-string.len("Mozilla Firefox"))=="Mozilla Firefox") then
undecorate_window();
end
debug_print("Window Name: " .. get_window_name());
debug_print("Application name: " .. get_application_name())
这是输出xprop -spy
:
Benguin ~>xprop -spy
GDK_TIMESTAMP_PROP(GDK_TIMESTAMP_PROP) = 0x61
WM_STATE(WM_STATE):
window state: Normal
icon window: 0x94ca5200
_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_MAXIMIZE_HORZ, _NET_WM_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_SHADE, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_STICK
_NET_FRAME_EXTENTS(CARDINAL) = 0, 0, 0, 0
_NET_WM_DESKTOP(CARDINAL) = 0
_NET_WM_STATE(ATOM) = _NET_WM_STATE_MAXIMIZED_HORZ, _NET_WM_STATE_MAXIMIZED_VERT
WM_HINTS(WM_HINTS):
Client accepts input or input focus: True
Initial state is Normal State.
bitmap id # to use for icon: 0x2e00023
bitmap id # of mask for icon: 0x2e00029
window id # of group leader: 0x2e00001
_GTK_THEME_VARIANT(UTF8_STRING) =
WM_WINDOW_ROLE(STRING) = "browser"
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x2, 0x0, 0x0, 0x0, 0x0
XdndAware(ATOM) = BITMAP
_NET_WM_ICON(CARDINAL) = Icon (32 x 32):
---SNIP ASCII GRAPHICS---
Icon (192 x 192):
(not shown)
_NET_WM_OPAQUE_REGION(CARDINAL) =
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 48234529, 48234530
_NET_WM_USER_TIME_WINDOW(WINDOW): window id # 0x2e00020
WM_CLIENT_LEADER(WINDOW): window id # 0x2e00001
_NET_WM_PID(CARDINAL) = 4039
WM_LOCALE_NAME(STRING) = "en_GB.UTF-8"
WM_CLIENT_MACHINE(STRING) = "C0mputer"
WM_NORMAL_HINTS(WM_SIZE_HINTS):
program specified minimum size: 300 by 87
program specified maximum size: 32767 by 32767
program specified base size: 300 by 87
window gravity: NorthWest
WM_PROTOCOLS(ATOM): protocols WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_CLASS(STRING) = "Navigator", "Firefox"
WM_ICON_NAME(STRING) = "Devilspie2 only detects Firefox windows on a restart; how can I fix this? - Unix & Linux Stack Exchange - Mozilla Firefox"
_NET_WM_ICON_NAME(UTF8_STRING) = "Devilspie2 only detects Firefox windows on a restart; how can I fix this? - Unix & Linux Stack Exchange - Mozilla Firefox"
WM_NAME(STRING) = "Devilspie2 only detects Firefox windows on a restart; how can I fix this? - Unix & Linux Stack Exchange - Mozilla Firefox"
_NET_WM_NAME(UTF8_STRING) = "Devilspie2 only detects Firefox windows on a restart; how can I fix this? - Unix & Linux Stack Exchange - Mozilla Firefox"