aboutsummaryrefslogtreecommitdiffstats
path: root/Magnifier.hs
diff options
context:
space:
mode:
authorPeter De Wachter <pdewacht@gmail.com>2007-08-05 16:10:51 +0200
committerPeter De Wachter <pdewacht@gmail.com>2007-08-05 16:10:51 +0200
commit36957f1a5efc6c259ebb667f98baf027c555b806 (patch)
tree9d6c92730c3f4f878ae453499066b44710b21dcc /Magnifier.hs
parentee191899155c0e4554378dca077867d3c7aedebb (diff)
downloadXMonadContrib-36957f1a5efc6c259ebb667f98baf027c555b806.tar.gz
XMonadContrib-36957f1a5efc6c259ebb667f98baf027c555b806.tar.xz
XMonadContrib-36957f1a5efc6c259ebb667f98baf027c555b806.zip
work around Magnifier's problems with floating windows
darcs-hash:20070805141051-06a25-c2f7959cfddd5662f8dd8c9e4837ef89b81c07c1.gz
Diffstat (limited to 'Magnifier.hs')
-rw-r--r--Magnifier.hs17
1 files changed, 9 insertions, 8 deletions
diff --git a/Magnifier.hs b/Magnifier.hs
index 584d869..f29cf3f 100644
--- a/Magnifier.hs
+++ b/Magnifier.hs
@@ -21,7 +21,7 @@ module XMonadContrib.Magnifier (
-- $usage
magnifier, magnifier') where
-import Graphics.X11.Xlib
+import Graphics.X11.Xlib (Window, Rectangle(..))
import XMonad
import StackSet
import XMonadContrib.LayoutHelpers
@@ -31,21 +31,22 @@ import XMonadContrib.LayoutHelpers
-- > defaultLayouts = [ magnifier tiled , magnifier $ mirror tiled ]
-- | Increase the size of the window that has focus, unless it is the master window.
-magnifier :: Eq a => Layout a -> Layout a
+magnifier :: Layout Window -> Layout Window
magnifier = layoutModify (unlessMaster applyMagnifier) idModMod
-- | Increase the size of the window that has focus, even if it is the master window.
-magnifier' :: Eq a => Layout a -> Layout a
+magnifier' :: Layout Window -> Layout Window
magnifier' = layoutModify applyMagnifier idModMod
-unlessMaster :: ModDo a -> ModDo a
+unlessMaster :: ModDo Window -> ModDo Window
unlessMaster mainmod r s wrs = if null (up s) then return (wrs, Nothing)
else mainmod r s wrs
-applyMagnifier :: Eq a => ModDo a
-applyMagnifier r s wrs = return (reverse $ foldr mag [] wrs, Nothing)
- where mag (w,wr) ws | w == focus s = ws ++ [(w, shrink r $ magnify wr)]
- | otherwise = (w,wr) : ws
+applyMagnifier :: ModDo Window
+applyMagnifier r _ wrs = do focused <- withWindowSet (return . peek)
+ let mag (w,wr) ws | focused == Just w = ws ++ [(w, shrink r $ magnify wr)]
+ | otherwise = (w,wr) : ws
+ return (reverse $ foldr mag [] wrs, Nothing)
magnify :: Rectangle -> Rectangle
magnify (Rectangle x y w h) = Rectangle x' y' w' h'