From f133862971203d08e8b213e75d91a312c15b40c1 Mon Sep 17 00:00:00 2001 From: Andrea Rossato Date: Fri, 6 Jul 2007 15:08:45 +0200 Subject: Tabbed: added more configuration options It is now possible to configure active and inactive border colors, and active and inactive text colors (i.e. tabs are now very similar to Ion3 tabs: former Ion users may appreciate). darcs-hash:20070706130845-32816-5fb790432b5e013ff546304448ae025c0ebf88b8.gz --- Tabbed.hs | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) (limited to 'Tabbed.hs') diff --git a/Tabbed.hs b/Tabbed.hs index 28bd906..20aece7 100644 --- a/Tabbed.hs +++ b/Tabbed.hs @@ -54,18 +54,22 @@ import XMonadContrib.LayoutHelpers ( idModify ) data TConf = TConf { activeColor :: String , inactiveColor :: String - , bgColor :: String - , textColor :: String - , fontName :: String + , activeBorderColor :: String + , inactiveTextColor :: String + , inactiveBorderColor :: String + , activeTextColor :: String + , fontName :: String , tabSize :: Int } deriving (Show, Read) - + defaultTConf :: TConf defaultTConf = TConf { activeColor ="#BBBBBB" , inactiveColor = "#888888" - , bgColor = "#000000" - , textColor = "#000000" + , activeBorderColor = "#FFFFFF" + , inactiveBorderColor = "#BFBFBF" + , activeTextColor = "#FFFFFF" + , inactiveTextColor = "#BFBFBF" , fontName = "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*" , tabSize = 20 } @@ -80,27 +84,30 @@ dolay :: Shrinker -> TConf -> Rectangle -> W.Stack Window -> X ([(Window, Rectangle)], Maybe (Layout Window)) dolay _ _ sc (W.Stack w [] []) = return ([(w,sc)], Nothing) dolay shr conf sc@(Rectangle x y wid _) s = withDisplay $ \dpy -> - do activecolor <- io $ initColor dpy $ activeColor conf - inactivecolor <- io $ initColor dpy $ inactiveColor conf - textcolor <- io $ initColor dpy $ textColor conf - bgcolor <- io $ initColor dpy $ bgColor conf + do ac <- io $ initColor dpy $ activeColor conf + ic <- io $ initColor dpy $ inactiveColor conf + abc <- io $ initColor dpy $ activeBorderColor conf + ibc <- io $ initColor dpy $ inactiveBorderColor conf + atc <- io $ initColor dpy $ activeTextColor conf + itc <- io $ initColor dpy $ inactiveTextColor conf let ws = W.integrate s ts = gentabs conf x y wid (length ws) tws = zip ts ws + focusColor w incol actcol = (maybe incol (\focusw -> if focusw == w + then actcol else incol) . W.peek) + `fmap` gets windowset make_tabs [] l = return l - make_tabs (tw':tws') l = do l' <- maketab tw' l + make_tabs (tw':tws') l = do bc <- focusColor (snd tw') ibc abc + l' <- maketab tw' bc l make_tabs tws' l' - maketab (t,ow) = newDecoration ow t 1 bgcolor activecolor - (fontName conf) (drawtab t ow) (focus ow) + maketab (t,ow) bg = newDecoration ow t 1 bg ac + (fontName conf) (drawtab t ow) (focus ow) drawtab r@(Rectangle _ _ wt ht) ow d w' gc fn = do nw <- getName ow - tabcolor <- (maybe inactivecolor (\focusw -> if focusw == ow - then activecolor - else inactivecolor) . W.peek) - `fmap` gets windowset - io $ setForeground d gc tabcolor + (fc,tc) <- focusColor ow (ic,itc) (ac,atc) + io $ setForeground d gc fc io $ fillRectangles d w' gc [Rectangle 0 0 wt ht] - io $ setForeground d gc textcolor + io $ setForeground d gc tc centerText d w' gc fn r (show nw) centerText d w' gc fontst (Rectangle _ _ wt ht) name = do let (_,asc,_,_) = textExtents fontst name -- cgit v1.2.3