mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 03:20:21 -07:00
X.L.SubLayouts: Simplify updateWs' using updateGroup
Turns out similar logic is already in updateGroup, and we don't even need to worry about extra/missing windows and we can just differentiate the result of reordering.
This commit is contained in:
parent
9c93d90970
commit
975a99d9dd
@ -62,7 +62,6 @@ 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,16 +441,12 @@ 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
|
w <- W.stack . W.workspace . W.current $ ws
|
||||||
let wins = W.index ws
|
let gs' = updateGroup (Just w) gs
|
||||||
let wset = S.fromList wins
|
nes = concatMap W.integrate $ mapMaybe (flip M.lookup gs') $ W.integrate w
|
||||||
let gset = S.fromList $ concatMap W.integrate $ M.elems $
|
w' <- focusWindow' (W.focus w) =<< W.differentiate nes
|
||||||
M.filterWithKey (\k _ -> k `S.member` wset) gs -- M.restrictKeys (ghc 8.2+)
|
guard $ w' /= w
|
||||||
st <- W.differentiate . concat $ flip map wins $ \w ->
|
return $ W.modify' (const w') ws
|
||||||
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
|
|
||||||
return ws'
|
|
||||||
|
|
||||||
-- | focusWindow'. focus an element of a stack, is Nothing if that element is
|
-- | focusWindow'. focus an element of a stack, is Nothing if that element is
|
||||||
-- absent. See also 'W.focusWindow'
|
-- absent. See also 'W.focusWindow'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user