aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Layout/TabBarDecoration.hs
diff options
context:
space:
mode:
authorAndrea Rossato <andrea.rossato@unibz.it>2008-02-18 19:09:22 +0100
committerAndrea Rossato <andrea.rossato@unibz.it>2008-02-18 19:09:22 +0100
commit45508f6a368c123d538a9a17343b12b61f13e3a6 (patch)
treecd833dd4a9504e75faf06e49d03d80cdbe252941 /XMonad/Layout/TabBarDecoration.hs
parent78c38194f66da823b31cd89a66977b87b9edd432 (diff)
downloadXMonadContrib-45508f6a368c123d538a9a17343b12b61f13e3a6.tar.gz
XMonadContrib-45508f6a368c123d538a9a17343b12b61f13e3a6.tar.xz
XMonadContrib-45508f6a368c123d538a9a17343b12b61f13e3a6.zip
TabBarDecoration: simpleTabBar automatically applies resizeVertical
Added some comments too. darcs-hash:20080218180922-32816-48097596437bbc30cd3414a7555fa5cf55ecec75.gz
Diffstat (limited to 'XMonad/Layout/TabBarDecoration.hs')
-rw-r--r--XMonad/Layout/TabBarDecoration.hs20
1 files changed, 15 insertions, 5 deletions
diff --git a/XMonad/Layout/TabBarDecoration.hs b/XMonad/Layout/TabBarDecoration.hs
index 00cfd03..0bae9ef 100644
--- a/XMonad/Layout/TabBarDecoration.hs
+++ b/XMonad/Layout/TabBarDecoration.hs
@@ -18,13 +18,16 @@ module XMonad.Layout.TabBarDecoration
simpleTabBar, tabBar
, defaultTheme, shrinkText
, TabBarDecoration (..), XPPosition (..)
+ , module XMonad.Layout.ResizeScreen
) where
import Data.List
import XMonad
import qualified XMonad.StackSet as S
import XMonad.Layout.Decoration
+import XMonad.Layout.ResizeScreen
import XMonad.Prompt ( XPPosition (..) )
+
-- $usage
-- You can use this module with the following in your
-- @~\/.xmonad\/xmonad.hs@:
@@ -46,9 +49,15 @@ import XMonad.Prompt ( XPPosition (..) )
-- selector. See "XMonad.Prompt.Theme". For more themse, look at
-- "XMonad.Util.Themes"
-simpleTabBar :: Eq a => l a -> ModifiedLayout (Decoration TabBarDecoration DefaultShrinker) l a
-simpleTabBar = decoration shrinkText defaultTheme (TabBar Top)
+-- | Add, on the top of the screen, a simple bar of tabs to a given
+-- | layout, with the default theme and the default shrinker.
+simpleTabBar :: Eq a => l a -> ModifiedLayout (Decoration TabBarDecoration DefaultShrinker)
+ (ModifiedLayout ResizeScreen l) a
+simpleTabBar = decoration shrinkText defaultTheme (TabBar Top) . resizeVertical 20
+-- | Same of 'simpleTabBar', but with the possibility of setting a
+-- custom shrinker, a custom theme and the position: 'Top' or
+-- 'Bottom'.
tabBar :: (Eq a, Shrinker s) => s -> Theme -> XPPosition -> l a -> ModifiedLayout (Decoration TabBarDecoration s) l a
tabBar s t p = decoration s t (TabBar p)
@@ -61,10 +70,11 @@ instance Eq a => DecorationStyle TabBarDecoration a where
decorationMouseDragHook _ _ _ = return ()
pureDecoration (TabBar p) _ dht (Rectangle x y wh ht) s _ (w,_) =
if isInStack s w then Just $ Rectangle nx ny nwh (fi dht) else Nothing
- where nwh = wh `div` max 1 (fi $ length $ S.integrate s)
- ny = case p of
+ where wrs = S.integrate s
+ nwh = wh `div` max 1 (fi $ length wrs)
+ ny = case p of
Top -> y
Bottom -> y + fi ht - fi dht
- nx = case w `elemIndex` (S.integrate s) of
+ nx = case w `elemIndex` wrs of
Just i -> x + (fi nwh * fi i)
Nothing -> x