aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Layout/ResizableTile.hs
diff options
context:
space:
mode:
authorBrent Yorgey <byorgey@gmail.com>2007-12-25 14:58:39 +0100
committerBrent Yorgey <byorgey@gmail.com>2007-12-25 14:58:39 +0100
commit8070e29e12c532555a11882e91b208ef8d51a107 (patch)
treeab3960e5aa814ce0d97e99094f44952e8440f76d /XMonad/Layout/ResizableTile.hs
parentc093ae93378a8462b39eae9d5f36e6aaeb5e2b2d (diff)
downloadXMonadContrib-8070e29e12c532555a11882e91b208ef8d51a107.tar.gz
XMonadContrib-8070e29e12c532555a11882e91b208ef8d51a107.tar.xz
XMonadContrib-8070e29e12c532555a11882e91b208ef8d51a107.zip
ResizableTile.hs: fix resizing to work in the presence of floating windows (resolves issue #100)
darcs-hash:20071225135839-bd4d7-3a64bff2c9942018e51078854e6c722329b7cdb0.gz
Diffstat (limited to 'XMonad/Layout/ResizableTile.hs')
-rw-r--r--XMonad/Layout/ResizableTile.hs18
1 files changed, 12 insertions, 6 deletions
diff --git a/XMonad/Layout/ResizableTile.hs b/XMonad/Layout/ResizableTile.hs
index 9c32bbb..a333ab2 100644
--- a/XMonad/Layout/ResizableTile.hs
+++ b/XMonad/Layout/ResizableTile.hs
@@ -24,6 +24,8 @@ module XMonad.Layout.ResizableTile (
import XMonad hiding (splitVertically, splitHorizontallyBy)
import qualified XMonad.StackSet as W
import Control.Monad
+import qualified Data.Map as M
+import Data.List ((\\))
-- $usage
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
@@ -58,12 +60,16 @@ instance LayoutClass ResizableTall a where
ap zip (tile frac (mfrac ++ repeat 1) r nmaster . length) . W.integrate
handleMessage (ResizableTall nmaster delta frac mfrac) m =
do ms <- (W.stack . W.workspace . W.current) `fmap` gets windowset
- case ms of
- Nothing -> return Nothing
- Just s -> return $ msum [fmap resize (fromMessage m)
- ,fmap (\x -> mresize x s) (fromMessage m)
- ,fmap incmastern (fromMessage m)]
- where resize Shrink = ResizableTall nmaster delta (max 0 $ frac-delta) mfrac
+ fs <- (M.keys . W.floating) `fmap` gets windowset
+ return $ ms >>= unfloat fs >>= handleMesg
+ where handleMesg s = msum [fmap resize (fromMessage m)
+ ,fmap (\x -> mresize x s) (fromMessage m)
+ ,fmap incmastern (fromMessage m)]
+ unfloat fs s = if W.focus s `elem` fs
+ then Nothing
+ else Just (s { W.up = (W.up s) \\ fs
+ , W.down = (W.down s) \\ fs })
+ resize Shrink = ResizableTall nmaster delta (max 0 $ frac-delta) mfrac
resize Expand = ResizableTall nmaster delta (min 1 $ frac+delta) mfrac
mresize MirrorShrink s = mresize' s delta
mresize MirrorExpand s = mresize' s (0-delta)