我的ManageHook不识别Spotify窗口,所以我不能自动将它移动到我想要打开的工作空间。它可以很好地与其他所有的窗口,除了Spotify。
这是我的Managehook:
myManageHook :: XMonad.Query (Data.Monoid.Endo WindowSet)
myManageHook = composeAll . concat $
[ [ isDialog --> doCenterFloat ]
, [ isFullscreen --> doFullFloat ]
, [(className =? c <||> title =? c <||> resource =? c) --> doIgnore | c <- bars ]
, [(className =? c <||> title =? c <||> resource =? c) --> doFloat | c <- float ]
, [(className =? c <||> title =? c <||> resource =? c) --> doCenterFloat | c <- cfloat ]
, [(className =? c <||> title =? c <||> resource =? c) --> doShift "0" | c <- ws0 ] -- 0
, [(className =? c <||> title =? c <||> resource =? c) --> doShift (myWorkspaces !! 0) | c <- ws1 ] -- i
, [(className =? c <||> title =? c <||> resource =? c) --> doShift (myWorkspaces !! 1) | c <- ws2 ] -- ii
, [(className =? c <||> title =? c <||> resource =? c) --> doShift (myWorkspaces !! 2) | c <- ws3 ] --iii
, [(className =? c <||> title =? c <||> resource =? c) --> doShift (myWorkspaces !! 3) | c <- ws4 ] -- iv
, [(className =? c <||> title =? c <||> resource =? c) --> doShift (myWorkspaces !! 4) | c <- ws5 ] -- v
, [(className =? c <||> title =? c <||> resource =? c) --> doShift (myWorkspaces !! 5) | c <- ws6 ] -- vi
, [(className =? c <||> title =? c <||> resource =? c) --> doShift (myWorkspaces !! 6) | c <- ws7 ] -- vii
, [(className =? c <||> title =? c <||> resource =? c) --> doShift (myWorkspaces !! 7) | c <- ws8 ] -- viii
, [(className =? c <||> title =? c <||> resource =? c) --> doShift (myWorkspaces !! 8) | c <- ws9 ] -- ix
]
where
bars = ["dzen2","desktop_window"]
float = ["feh","conky_mpd"]
cfloat = ["Xmessage","Gxmessage","Eog","xclock"]
++ ["SimpleScreenRecorder","Evolution-alarm-notify","Evolution","Gns3","Mtpaint","Calculator","world-clock","wifi-qrcode","agenda-term","arandr"]
++ ["xeyes", "pinentry","zoiper","blueman-manager","system-config-printer","Solaar", "nm-connection-editor", "Save File", "Gscreenshot", "qalculate-gtk"]
ws0 = [""] --
ws1 = [""] --dev
ws2 = ["Mozilla Firefox", "Opera", "vivaldi-stable", "min"] --www
ws3 = ["Spotify"] --mus
ws4 = ["postman"] --doc
ws5 = ["VirtualBox Manager"] --vbox
ws6 = ["discord", "zoom", "Mail"] --chat
ws7 = [""] --sys
ws8 = ["mpv", "vlc"] --vid
ws9 = ["Gimp", "Olive", "obs"] --gfx
role = stringProperty "WM_WINDOW_ROLE" -- example
和Spotify的xprop输出:
XdndProxy(WINDOW): window id # 0x1c00004
_NET_WM_DESKTOP(CARDINAL) = 0
WM_CLASS(STRING) = "spotify", "Spotify"
WM_NAME(STRING) = "Spotify"
_NET_WM_NAME(UTF8_STRING) = "Spotify"
WM_STATE(WM_STATE):
window state: Normal
icon window: 0x0
WM_NORMAL_HINTS(WM_SIZE_HINTS):
program specified location: 0, 0
_NET_WM_PID(CARDINAL) = 18790
WM_CLIENT_MACHINE(STRING) = "arch-acer"
WM_PROTOCOLS(ATOM): protocols WM_DELETE_WINDOW, _NET_WM_PING
我已经尝试重新编译xmonad配置并重新启动,这没有改变任何东西
Reddit上也有人问过类似的问题,答案是下面的链接。
简单地说,它有助于使用DynamicProperty。一个具体的例子如何使用它张贴在这里。