X.L.SubLayouts: Avoid moving floats to end of window stack

This makes the following sequence of operations idempotent, as it should be:

    windows $ W.float w $ W.RationalRect 0 0 1 1
    windows $ W.sink w

Previously, any window not visible to the SubLayout modifier (xmonad
invokes runLayout with tiled windows only) would be reordered to the end
of stack. This commit changes the reordering logic to only reorder
windows in Groups and keep all other windows where they were.
This commit is contained in:
Tomas Janousek 2020-11-17 12:20:10 +00:00
parent da59f9f360
commit 9c93d90970
2 changed files with 12 additions and 3 deletions

View File

@ -547,6 +547,10 @@
- Added `defWPNamesJpg` as an alias to `defWPNames` and deprecated - Added `defWPNamesJpg` as an alias to `defWPNames` and deprecated
the latter. the latter.
* `XMonad.Layout.SubLayouts`
- Floating windows are no longer moved to the end of the window stack.
## 0.16 ## 0.16
### Breaking Changes ### Breaking Changes

View File

@ -62,6 +62,7 @@ import qualified XMonad.Layout.BoringWindows as B
import qualified XMonad.StackSet as W import qualified XMonad.StackSet as W
import qualified Data.Map as M import qualified Data.Map as M
import Data.Map(Map) import Data.Map(Map)
import qualified Data.Set as S
-- $screenshots -- $screenshots
-- --
@ -442,9 +443,13 @@ updateWs = windowsMaybe . updateWs'
updateWs' :: Groups Window -> WindowSet -> Maybe WindowSet updateWs' :: Groups Window -> WindowSet -> Maybe WindowSet
updateWs' gs ws = do updateWs' gs ws = do
f <- W.peek ws f <- W.peek ws
let w = W.index ws let wins = W.index ws
nes = concatMap W.integrate $ mapMaybe (flip M.lookup gs) w let wset = S.fromList wins
ws' = W.focusWindow f $ foldr W.insertUp (foldr W.delete' ws nes) nes let gset = S.fromList $ concatMap W.integrate $ M.elems $
M.filterWithKey (\k _ -> k `S.member` wset) gs -- M.restrictKeys (ghc 8.2+)
st <- W.differentiate . concat $ flip map wins $ \w ->
if w `S.member` gset then maybe [] W.integrate (w `M.lookup` gs) else [w]
let ws' = W.focusWindow f $ W.modify' (const st) ws
guard $ W.index ws' /= W.index ws guard $ W.index ws' /= W.index ws
return ws' return ws'