{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-}------------------------------------------------------------------------------- |-- Module : XMonad.Layout.TabBarDecoration-- Copyright : (c) 2007 Andrea Rossato-- License : BSD-style (see xmonad/LICENSE)---- Maintainer : andrea.rossato@unibz.it-- Stability : unstable-- Portability : unportable---- A layout modifier to add a bar of tabs to your layouts.-----------------------------------------------------------------------------moduleXMonad.Layout.TabBarDecoration(-- * Usage-- $usagesimpleTabBar,tabBar,defaultTheme,shrinkText,TabBarDecoration(..),XPPosition(..),moduleXMonad.Layout.ResizeScreen)whereimportData.ListimportXMonadimportqualifiedXMonad.StackSetasSimportXMonad.Layout.DecorationimportXMonad.Layout.ResizeScreenimportXMonad.Prompt(XPPosition(..))-- $usage-- You can use this module with the following in your-- @~\/.xmonad\/xmonad.hs@:---- > import XMonad.Layout.TabBarDecoration---- Then edit your @layoutHook@ by adding the layout you want:---- > main = xmonad defaultConfig { layoutHook = simpleTabBar $ layoutHook defaultConfig}---- For more detailed instructions on editing the layoutHook see:---- "XMonad.Doc.Extending#Editing_the_layout_hook"---- 'tabBar' will give you the possibility of setting a custom shrinker-- and a custom theme.---- The deafult theme can be dynamically change with the xmonad theme-- selector. See "XMonad.Prompt.Theme". For more themse, look at-- "XMonad.Util.Themes"-- | 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::Eqa=>la->ModifiedLayout(DecorationTabBarDecorationDefaultShrinker)(ModifiedLayoutResizeScreenl)asimpleTabBar=decorationshrinkTextdefaultTheme(TabBarTop).resizeVertical20-- | Same of 'simpleTabBar', but with the possibility of setting a-- custom shrinker, a custom theme and the position: 'Top' or-- 'Bottom'.tabBar::(Eqa,Shrinkers)=>s->Theme->XPPosition->la->ModifiedLayout(DecorationTabBarDecorations)latabBarstp=decorationst(TabBarp)dataTabBarDecorationa=TabBarXPPositionderiving(Read,Show)instanceEqa=>DecorationStyleTabBarDecorationawheredescribeDeco_="TabBar"shrink__r=rdecorationMouseDragHook___=return()pureDecoration(TabBarp)_dht(Rectanglexywhht)s_(w,_)=ifisInStackswthenJust$Rectanglenxnywid(fidht)elseNothingwherewrs=S.integratesloci=(wh*fii)`div`max1(fi$lengthwrs)wid=maybe(fix)(\i->loc(i+1)-loci)$w`elemIndex`wrsny=casepofTop->yBottom->y+fiht-fidhtnx=(x+)$maybe0(fi.loc)$w`elemIndex`wrs