aboutsummaryrefslogtreecommitdiffstats
path: root/TwoPane.hs
diff options
context:
space:
mode:
authorSpencer Janssen <sjanssen@cse.unl.edu>2007-05-19 00:42:40 +0200
committerSpencer Janssen <sjanssen@cse.unl.edu>2007-05-19 00:42:40 +0200
commitce00db454082a51ec95c817e97757e2e56f4ef8e (patch)
tree8535fab273e5e804d7548f0cbf05636d0351abcc /TwoPane.hs
parentfffadfbf70e5933955895434d83e1aea54b4d3ec (diff)
downloadXMonadContrib-ce00db454082a51ec95c817e97757e2e56f4ef8e.tar.gz
XMonadContrib-ce00db454082a51ec95c817e97757e2e56f4ef8e.tar.xz
XMonadContrib-ce00db454082a51ec95c817e97757e2e56f4ef8e.zip
TwoPane: hide windows that aren't in view
darcs-hash:20070518224240-a5988-6cf094f4b9cad663ca305c01a5e6b023bd77e04f.gz
Diffstat (limited to 'TwoPane.hs')
-rw-r--r--TwoPane.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/TwoPane.hs b/TwoPane.hs
index 0007c38..56925c6 100644
--- a/TwoPane.hs
+++ b/TwoPane.hs
@@ -15,12 +15,14 @@ import Control.Monad.State (gets)
twoPane :: Rational -> Rational -> Layout
twoPane delta split = Layout { doLayout = arrange, modifyLayout = message }
where
- arrange rect (w:x:_) = do
+ arrange rect ws@(w:x:_) = do
(Just f) <- gets (W.peek . workspace) -- safe because of pattern match above
- let (left, right) = splitHorizontallyBy split rect
- return [(w, left), (if f == w then x else f, right)]
+ let y = if f == w then x else f
+ (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
- arrange rect ws = return . map (\w -> (w, rect)) $ ws
+ arrange rect ws = return . map (\w -> (w, rect)) $ ws
message x = case fromMessage x of
Just Shrink -> Just (twoPane delta (split - delta))