From 3839c8bce99b6f07bf7074da79110e29e5038ff8 Mon Sep 17 00:00:00 2001 From: Tomas Janousek Date: Sat, 27 Apr 2024 14:24:45 +0200 Subject: [PATCH] X.H.EwmhDesktops: Fix menus in Steam client MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit More specifically, ignore ClientMessageEvents for unmanaged windows. Steam likes to send _NET_ACTIVE_WINDOW requests for all its windows, including override-redirect ones, which used to result in an invocation of `windows` with a no-op Endo—equivalent to a call to `refresh`. But this refresh makes Steam close its menus immediately. Fixes: https://github.com/ValveSoftware/steam-for-linux/issues/9376 Fixes: https://github.com/xmonad/xmonad/issues/451 --- XMonad/Hooks/EwmhDesktops.hs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/XMonad/Hooks/EwmhDesktops.hs b/XMonad/Hooks/EwmhDesktops.hs index cfb1b91df..337de252c 100644 --- a/XMonad/Hooks/EwmhDesktops.hs +++ b/XMonad/Hooks/EwmhDesktops.hs @@ -459,7 +459,14 @@ ewmhDesktopsEventHook' a_aw <- getAtom "_NET_ACTIVE_WINDOW" a_cw <- getAtom "_NET_CLOSE_WINDOW" - if | mt == a_cd, n : _ <- d, Just ww <- ws !? fi n -> + if | mt == a_cw -> + killWindow w + | not (w `W.member` s) -> + -- do nothing for unmanaged windows; it'd be just a useless + -- refresh which breaks menus/popups of misbehaving apps that + -- send _NET_ACTIVE_WINDOW requests for override-redirect wins + mempty + | mt == a_cd, n : _ <- d, Just ww <- ws !? fi n -> if W.currentTag s == W.tag ww then mempty else windows $ W.view (W.tag ww) | mt == a_cd -> trace $ "Bad _NET_CURRENT_DESKTOP with data=" ++ show d @@ -473,8 +480,6 @@ ewmhDesktopsEventHook' if W.peek s == Just w then mempty else windows $ W.focusWindow w | mt == a_aw -> do if W.peek s == Just w then mempty else windows . appEndo =<< runQuery activateHook w - | mt == a_cw -> - killWindow w | otherwise -> -- The Message is unknown to us, but that is ok, not all are meant -- to be handled by the window manager