aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Cheplyaka <roma@ro-che.info>2008-02-29 16:51:20 +0100
committerRoman Cheplyaka <roma@ro-che.info>2008-02-29 16:51:20 +0100
commit00f8a18b0d6825777bd544384f6cc4c06f837530 (patch)
treed4077257688cd7390d5da344a324781f68b244c9
parent8691c81c05b16e31644c0c373652f7056f0c2d17 (diff)
downloadXMonadContrib-00f8a18b0d6825777bd544384f6cc4c06f837530.tar.gz
XMonadContrib-00f8a18b0d6825777bd544384f6cc4c06f837530.tar.xz
XMonadContrib-00f8a18b0d6825777bd544384f6cc4c06f837530.zip
Add bottom-tabbed layout.
darcs-hash:20080229155120-3ebed-40c00f07292afbad1f0c7ead178e30797fefdf9e.gz
-rw-r--r--XMonad/Layout/Tabbed.hs34
1 files changed, 29 insertions, 5 deletions
diff --git a/XMonad/Layout/Tabbed.hs b/XMonad/Layout/Tabbed.hs
index 1538d1a..d8e3058 100644
--- a/XMonad/Layout/Tabbed.hs
+++ b/XMonad/Layout/Tabbed.hs
@@ -18,6 +18,7 @@ module XMonad.Layout.Tabbed
( -- * Usage:
-- $usage
simpleTabbed, tabbed, addTabs
+ , simpleTabbedBottom, tabbedBottom, addTabsBottom
, Theme (..)
, defaultTheme
, TabbedDecoration (..)
@@ -76,27 +77,50 @@ import XMonad.Layout.Simplest ( Simplest(Simplest) )
simpleTabbed :: ModifiedLayout (Decoration TabbedDecoration DefaultShrinker) Simplest Window
simpleTabbed = decoration shrinkText defaultTheme Tabbed Simplest
+-- | A bottom-tabbed layout with the default xmonad Theme.
+simpleTabbedBottom :: ModifiedLayout (Decoration TabbedDecoration DefaultShrinker) Simplest Window
+simpleTabbedBottom = decoration shrinkText defaultTheme TabbedBottom Simplest
+
-- | A layout decorated with tabs and the possibility to set a custom
-- shrinker and a custom theme.
tabbed :: (Eq a, Shrinker s) => s -> Theme
-> ModifiedLayout (Decoration TabbedDecoration s) Simplest a
tabbed s c = decoration s c Tabbed Simplest
+-- | A layout decorated with tabs at the bottom and the possibility to set a custom
+-- shrinker and a custom theme.
+tabbedBottom :: (Eq a, Shrinker s) => s -> Theme
+ -> ModifiedLayout (Decoration TabbedDecoration s) Simplest a
+tabbedBottom s c = decoration s c TabbedBottom Simplest
+
addTabs :: (Eq a, LayoutClass l a, Shrinker s) => s -> Theme -> l a
-> ModifiedLayout (Decoration TabbedDecoration s) l a
addTabs s c l = decoration s c Tabbed l
-data TabbedDecoration a = Tabbed deriving (Read, Show)
+addTabsBottom :: (Eq a, LayoutClass l a, Shrinker s) => s -> Theme -> l a
+ -> ModifiedLayout (Decoration TabbedDecoration s) l a
+addTabsBottom s c l = decoration s c TabbedBottom l
+
+data TabbedDecoration a = Tabbed | TabbedBottom deriving (Read, Show)
instance Eq a => DecorationStyle TabbedDecoration a where
- describeDeco _ = "Tabbed"
+ describeDeco Tabbed = "Tabbed"
+ describeDeco TabbedBottom = "Tabbed Bottom"
decorationMouseDragHook _ _ _ = return ()
- pureDecoration _ _ ht _ s wrs (w,r@(Rectangle x y wh _)) =
- if length wrs' <= 1 then Nothing
- else Just $ Rectangle nx y nwh (fi ht)
+ pureDecoration ds _ ht _ s wrs (w,r@(Rectangle x y wh hh)) =
+ if length wrs' <= 1
+ then Nothing
+ else Just $ case ds of
+ Tabbed -> Rectangle nx y nwh (fi ht)
+ TabbedBottom -> Rectangle nx (y+fi(hh-ht)) nwh (fi ht)
+
where wrs' = filter ((==r) . snd) wrs
ws = map fst wrs'
nwh = wh `div` max 1 (fi $ length wrs')
nx = case elemIndex w $ filter (`elem` ws) (S.integrate s) of
Just i -> x + (fi nwh * fi i)
Nothing -> x
+
+ shrink ds (Rectangle _ _ _ dh) (Rectangle x y w h) = case ds of
+ Tabbed -> Rectangle x (y + fi dh) w (h - dh)
+ TabbedBottom -> Rectangle x y w (h - dh)