aboutsummaryrefslogtreecommitdiffstats
path: root/Magnifier.hs
diff options
context:
space:
mode:
authorSpencer Janssen <sjanssen@cse.unl.edu>2007-11-01 21:10:59 +0100
committerSpencer Janssen <sjanssen@cse.unl.edu>2007-11-01 21:10:59 +0100
commit4866f2e367dfcf22a9591231ba40948826a1b438 (patch)
tree7a245caee3f146826b267d773b7eaa80386a818e /Magnifier.hs
parent47589e1913fb9530481caedb543978a30d4323ea (diff)
downloadXMonadContrib-4866f2e367dfcf22a9591231ba40948826a1b438.tar.gz
XMonadContrib-4866f2e367dfcf22a9591231ba40948826a1b438.tar.xz
XMonadContrib-4866f2e367dfcf22a9591231ba40948826a1b438.zip
Hierarchify
darcs-hash:20071101201059-a5988-fc1f1262bec1b69e13ba18ae7cefeafc8c4471d4.gz
Diffstat (limited to 'Magnifier.hs')
-rw-r--r--Magnifier.hs69
1 files changed, 0 insertions, 69 deletions
diff --git a/Magnifier.hs b/Magnifier.hs
deleted file mode 100644
index 3997d5d..0000000
--- a/Magnifier.hs
+++ /dev/null
@@ -1,69 +0,0 @@
-{-# OPTIONS_GHC -fglasgow-exts #-}
-
------------------------------------------------------------------------------
--- |
--- Module : XMonadContrib.Magnifier
--- Copyright : (c) Peter De Wachter 2007
--- License : BSD-style (see xmonad/LICENSE)
---
--- Maintainer : Peter De Wachter <pdewacht@gmail.com>
--- Stability : unstable
--- Portability : unportable
---
--- Screenshot : <http://caladan.rave.org/magnifier.png>
---
--- This layout hack increases the size of the window that has focus.
---
------------------------------------------------------------------------------
-
-
-module XMonadContrib.Magnifier (
- -- * Usage
- -- $usage
- magnifier, magnifier') where
-
-import Graphics.X11.Xlib (Window, Rectangle(..))
-import XMonad
-import XMonad.StackSet
-import XMonadContrib.LayoutHelpers
-
--- $usage
--- > import XMonadContrib.Magnifier
--- > layouts = [ magnifier tiled , magnifier $ mirror tiled ]
-
--- %import XMonadContrib.Magnifier
--- %layout , magnifier tiled
--- %layout , magnifier $ mirror tiled
-
--- | Increase the size of the window that has focus, unless it is the master window.
-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' :: Layout Window -> Layout Window
-magnifier' = layoutModify applyMagnifier idModMod
-
-unlessMaster :: ModDo Window -> ModDo Window
-unlessMaster mainmod r s wrs = if null (up s) then return (wrs, Nothing)
- else mainmod r s wrs
-
-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'
- where x' = x - fromIntegral (w' - w) `div` 2
- y' = y - fromIntegral (h' - h) `div` 2
- w' = round $ fromIntegral w * zoom
- h' = round $ fromIntegral h * zoom
- zoom = 1.5 :: Double
-
-shrink :: Rectangle -> Rectangle -> Rectangle
-shrink (Rectangle sx sy sw sh) (Rectangle x y w h) = Rectangle x' y' w' h'
- where x' = max sx x
- y' = max sy y
- w' = min w (fromIntegral sx + sw - fromIntegral x')
- h' = min h (fromIntegral sy + sh - fromIntegral y')