diff options
author | nornagon <nornagon@gmail.com> | 2007-10-06 01:00:38 +0200 |
---|---|---|
committer | nornagon <nornagon@gmail.com> | 2007-10-06 01:00:38 +0200 |
commit | bfdc44fcc698a156d1284cf574cf92030a418b9b (patch) | |
tree | da4265cc1b4de19aea6ebe1646f7aeb6c0e90f19 | |
parent | 98ce4744cdb4d34f4437f74e932913240b223028 (diff) | |
download | XMonadContrib-bfdc44fcc698a156d1284cf574cf92030a418b9b.tar.gz XMonadContrib-bfdc44fcc698a156d1284cf574cf92030a418b9b.tar.xz XMonadContrib-bfdc44fcc698a156d1284cf574cf92030a418b9b.zip |
Dishes layout. Stacks windows underneath masters.
darcs-hash:20071005230038-25eb7-241624ec75e3387f6b3640f60e4bfa38c9384bb2.gz
Diffstat (limited to '')
-rw-r--r-- | Dishes.hs | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/Dishes.hs b/Dishes.hs new file mode 100644 index 0000000..418bd6c --- /dev/null +++ b/Dishes.hs @@ -0,0 +1,50 @@ +----------------------------------------------------------------------------- +-- | +-- Module : XMonadContrib.Dishes +-- Copyright : (c) Jeremy Apthorp +-- License : BSD-style (see LICENSE) +-- +-- Maintainer : Jeremy Apthorp <nornagon@gmail.com> +-- Stability : unstable +-- Portability : portable +-- +-- Dishes is a layout that stacks extra windows underneath the master +-- windows. +-- +----------------------------------------------------------------------------- + +module XMonadContrib.Dishes ( + -- * Usage + -- $usage + Dishes (..) + ) where + +import Data.List +import XMonad +import Operations +import StackSet (integrate) +import Control.Monad (ap) +import Graphics.X11.Xlib + +-- $usage +-- You can use this module with the following in your Config.hs file: +-- +-- > import XMonadContrib.Dishes + +-- %import XMonadContrib.Dishes + +data Dishes a = Dishes Int Rational deriving (Show, Read) +instance LayoutClass Dishes a where + doLayout (Dishes nmaster h) r = + return . (\x->(x,Nothing)) . + ap zip (dishes h r nmaster . length) . integrate + handleMessage (Dishes nmaster h) m = return $ fmap incmastern (fromMessage m) + where incmastern (IncMasterN d) = Dishes (max 0 (nmaster+d)) h + +dishes :: Rational -> Rectangle -> Int -> Int -> [Rectangle] +dishes h s nmaster n = if n <= nmaster + then splitHorizontally n s + else ws + where + (m,rest) = splitVerticallyBy (1 - (fromIntegral $ n - nmaster) * h) s + ws = splitHorizontally nmaster m ++ splitVertically (n - nmaster) rest |