mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-15 20:23:55 -07:00
TwoPane: hide windows that aren't in view
This commit is contained in:
10
TwoPane.hs
10
TwoPane.hs
@@ -15,12 +15,14 @@ import Control.Monad.State (gets)
|
|||||||
twoPane :: Rational -> Rational -> Layout
|
twoPane :: Rational -> Rational -> Layout
|
||||||
twoPane delta split = Layout { doLayout = arrange, modifyLayout = message }
|
twoPane delta split = Layout { doLayout = arrange, modifyLayout = message }
|
||||||
where
|
where
|
||||||
arrange rect (w:x:_) = do
|
arrange rect ws@(w:x:_) = do
|
||||||
(Just f) <- gets (W.peek . workspace) -- safe because of pattern match above
|
(Just f) <- gets (W.peek . workspace) -- safe because of pattern match above
|
||||||
let (left, right) = splitHorizontallyBy split rect
|
let y = if f == w then x else f
|
||||||
return [(w, left), (if f == w then x else f, right)]
|
(left, right) = splitHorizontallyBy split rect
|
||||||
|
mapM_ hide . filter (\a -> a /= w && a /= y) $ ws
|
||||||
|
return [(w, left), (y, right)]
|
||||||
-- there are one or zero windows
|
-- there are one or zero windows
|
||||||
arrange rect ws = return . map (\w -> (w, rect)) $ ws
|
arrange rect ws = return . map (\w -> (w, rect)) $ ws
|
||||||
|
|
||||||
message x = case fromMessage x of
|
message x = case fromMessage x of
|
||||||
Just Shrink -> Just (twoPane delta (split - delta))
|
Just Shrink -> Just (twoPane delta (split - delta))
|
||||||
|
Reference in New Issue
Block a user