X.L.MagicFocus: always use focused as master

Instead of searching for the currently focused window across workspaces,
make it so there is never any window above focus on the Stack that is
given to the modified layout.

Closes #657.
This commit is contained in:
d3adb5
2021-11-27 17:06:27 -03:00
parent 3d71669b0a
commit 97beb3efc7
2 changed files with 10 additions and 7 deletions

View File

@@ -57,14 +57,11 @@ magicFocus = ModifiedLayout MagicFocus
data MagicFocus a = MagicFocus deriving (Show, Read)
instance LayoutModifier MagicFocus Window where
modifyLayout MagicFocus (W.Workspace i l s) r =
withWindowSet $ \wset ->
runLayout (W.Workspace i l (s >>= \st -> Just $ swap st (W.peek wset))) r
modifyLayout MagicFocus (W.Workspace i l s) =
runLayout (W.Workspace i l (s >>= Just . shift))
swap :: (Eq a) => W.Stack a -> Maybe a -> W.Stack a
swap (W.Stack f u d) focused
| Just f == focused = W.Stack f [] (reverse u ++ d)
| otherwise = W.Stack f u d
shift :: (Eq a) => W.Stack a -> W.Stack a
shift (W.Stack f u d) = W.Stack f [] (reverse u ++ d)
-- | An eventHook that overrides the normal focusFollowsMouse. When the mouse
-- it moved to another window, that window is replaced as the master, and the