From 43592c84d4dbfd170f7f29819e3a760b89626e80 Mon Sep 17 00:00:00 2001 From: Tomas Janousek Date: Mon, 15 Feb 2021 17:07:21 +0000 Subject: [PATCH] X.L.TrackFloating: Fix changing focus on inactive workspaces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When focus changes¹ on an inactive workspace (not `current`, but `visible`), TrackFloating and UseTransientFor would think they should use the remembered focus point as they look at the wrong (`current`) workspace instead of the workspace they're supposed to layout, and so focus seems to be out of their set of windows, when actually it is not. Fix this by looking at the correct workspace. ¹) This isn't entirely straightforward, as there are normally no keybindings or StackSet operations for this, but it's perfectly legal to `W.view` the inactive workspace, change focus, and `W.view` back in a single `windows` action. --- CHANGES.md | 4 ++++ XMonad/Layout/TrackFloating.hs | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index f7a4c2a4..b3feb884 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -407,6 +407,10 @@ - Fixed handling of floating window borders in multihead setups that was broken since 0.14. + * `XMonad.Layout.TrackFloating` + + - Fixed a bug that prevented changing focus on inactive workspaces. + ## 0.16 ### Breaking Changes diff --git a/XMonad/Layout/TrackFloating.hs b/XMonad/Layout/TrackFloating.hs index d75f678f..8d682e0e 100644 --- a/XMonad/Layout/TrackFloating.hs +++ b/XMonad/Layout/TrackFloating.hs @@ -51,7 +51,7 @@ data TrackFloating a = TrackFloating (Maybe Window) instance LayoutModifier TrackFloating Window where modifyLayoutWithUpdate (TrackFloating mw) ws@(W.Workspace{ W.stack = ms }) r = do - xCur <- gets (W.peek . windowset) + xCur <- gets (W.peek . W.view (W.tag ws) . windowset) let isF = xCur /= (W.focus <$> ms) -- use the remembered focus point when true focus differs from -- what this (sub)layout is given, which happens e.g. when true @@ -75,7 +75,7 @@ data UseTransientFor a = UseTransientFor deriving (Read,Show,Eq) instance LayoutModifier UseTransientFor Window where modifyLayout _ ws@(W.Workspace{ W.stack = ms }) r = do - m <- gets (W.peek . windowset) + m <- gets (W.peek . W.view (W.tag ws) . windowset) d <- asks display parent <- join <$> T.traverse (io . getTransientForHint d) m