aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Layout
diff options
context:
space:
mode:
authorAndrea Rossato <andrea.rossato@unibz.it>2007-11-22 20:01:24 +0100
committerAndrea Rossato <andrea.rossato@unibz.it>2007-11-22 20:01:24 +0100
commit862f79967c00eb0ee3aaff20aebe17603b414ef4 (patch)
tree00444ca3038cc4c05fec5ac5083866d69b697a82 /XMonad/Layout
parent0ace7cde2d2f2773ce58eaa71e8a3b2f70dede47 (diff)
downloadXMonadContrib-862f79967c00eb0ee3aaff20aebe17603b414ef4.tar.gz
XMonadContrib-862f79967c00eb0ee3aaff20aebe17603b414ef4.tar.xz
XMonadContrib-862f79967c00eb0ee3aaff20aebe17603b414ef4.zip
Magnifier: some fixes and refactoring. It now works properly.
darcs-hash:20071122190124-32816-6e6366a5b0a872479bdd2d06c8b29952c66adff7.gz
Diffstat (limited to 'XMonad/Layout')
-rw-r--r--XMonad/Layout/Magnifier.hs56
1 files changed, 34 insertions, 22 deletions
diff --git a/XMonad/Layout/Magnifier.hs b/XMonad/Layout/Magnifier.hs
index 823cfca..633bd65 100644
--- a/XMonad/Layout/Magnifier.hs
+++ b/XMonad/Layout/Magnifier.hs
@@ -1,18 +1,19 @@
{-# OPTIONS_GHC -fglasgow-exts #-}
-
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Layout.Magnifier
-- Copyright : (c) Peter De Wachter 2007
-- License : BSD-style (see xmonad/LICENSE)
--
--- Maintainer : Peter De Wachter <pdewacht@gmail.com>
+-- Maintainer : Peter De Wachter <pdewacht@gmail.com>,
+-- andrea.rossato@unibz.it
-- Stability : unstable
-- Portability : unportable
--
-- Screenshot : <http://caladan.rave.org/magnifier.png>
--
--- This layout hack increases the size of the window that has focus.
+-- This is a layout modifier that will make a layout increase the size
+-- of the window that has focus.
--
-----------------------------------------------------------------------------
@@ -21,8 +22,7 @@ module XMonad.Layout.Magnifier (
-- * Usage
-- $usage
magnifier,
- Magnifier(..),
- Magnifier'(..)) where
+ magnifier') where
import Graphics.X11.Xlib (Window, Rectangle(..))
import XMonad
@@ -30,29 +30,41 @@ import XMonad.StackSet
import XMonad.Layout.LayoutModifier
-- $usage
+-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
+--
-- > import XMonad.Layout.Magnifier
--- > layouts = [ magnifier tiled , magnifier $ mirror tiled ]
+--
+-- Then edit your @layoutHook@ by adding the Magnifier layout modifier
+-- to some layout:
+--
+-- > myLayouts = magnifier (Tall 1 (3/100) (1/2)) ||| Full ||| etc..
+-- > main = xmonad dafaultConfig { layoutHook = myLayouts }
+--
+-- For more detailed instructions on editing the layoutHook see:
+--
+-- "XMonad.Doc.Extending#Editing_the_layout_hook"
--- %import XMonad.Layout.Magnifier
--- %layout , magnifier tiled
--- %layout , magnifier $ mirror tiled
+-- | Increase the size of the window that has focus, unless it is the
+-- master window.
+magnifier :: l a -> ModifiedLayout Magnifier l a
+magnifier = ModifiedLayout (M True)
--- | Increase the size of the window that has focus, unless it is the master window.
-data Magnifier a = Magnifier deriving (Read, Show)
-instance LayoutModifier Magnifier Window where
- modifierDescription _ = "Magnifier"
- redoLayout _ = unlessMaster applyMagnifier
+-- | Increase the size of the window that has focus, even if it is the
+-- master window.
+magnifier' :: l a -> ModifiedLayout Magnifier l a
+magnifier' = ModifiedLayout (M False)
--- | Increase the size of the window that has focus, even if it is the master window.
-data Magnifier' a = Magnifier' deriving (Read, Show)
-instance LayoutModifier Magnifier' Window where
- modifierDescription _ = "Magnifier'"
- redoLayout _ = applyMagnifier
+data Magnifier a = M Bool deriving (Read, Show)
-magnifier :: l a -> ModifiedLayout Magnifier l a
-magnifier = ModifiedLayout Magnifier
+instance LayoutModifier Magnifier Window where
+ modifierDescription (M b) = (if b then "" else "All") ++ "Magnifier"
+ redoLayout (M b) = if b
+ then unlessMaster applyMagnifier
+ else applyMagnifier
+
+type NewLayout a = Rectangle -> Stack a -> [(Window, Rectangle)] -> X ([(Window, Rectangle)], Maybe (Magnifier a))
-unlessMaster :: forall t t1 a a1 (m :: * -> *). (Monad m) => (t -> Stack a -> t1 -> m (t1, Maybe a1)) -> t -> Stack a -> t1 -> m (t1, Maybe a1)
+unlessMaster :: NewLayout a -> NewLayout a
unlessMaster mainmod r s wrs = if null (up s) then return (wrs, Nothing)
else mainmod r s wrs