diff options
author | Jan Vornberger <jan.vornberger@informatik.uni-oldenburg.de> | 2009-10-24 23:39:28 +0200 |
---|---|---|
committer | Jan Vornberger <jan.vornberger@informatik.uni-oldenburg.de> | 2009-10-24 23:39:28 +0200 |
commit | c0d896b8c04cce75488395cc679085bbc18b043b (patch) | |
tree | 7215b9d6cd65cc040fa1140bfaa4ef8ba2a47427 | |
parent | 4da4e91a5ab9361451bad2a51a565115bbc0d79e (diff) | |
download | XMonadContrib-c0d896b8c04cce75488395cc679085bbc18b043b.tar.gz XMonadContrib-c0d896b8c04cce75488395cc679085bbc18b043b.tar.xz XMonadContrib-c0d896b8c04cce75488395cc679085bbc18b043b.zip |
Extended decoration theme to contain extra static text that always appears in the title bar
Ignore-this: 95f46d6b9ff716a2d8002a426c1012c8
darcs-hash:20091024213928-594c5-bd98d27b6a6389e04aeef5e1a80d9dbf2a32c46b.gz
-rw-r--r-- | XMonad/Layout/Decoration.hs | 6 | ||||
-rw-r--r-- | XMonad/Util/Font.hsc | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/XMonad/Layout/Decoration.hs b/XMonad/Layout/Decoration.hs index eee686b..9288d4e 100644 --- a/XMonad/Layout/Decoration.hs +++ b/XMonad/Layout/Decoration.hs @@ -77,6 +77,7 @@ data Theme = , fontName :: String -- ^ Font name , decoWidth :: Dimension -- ^ Maximum width of the decorations (if supported by the 'DecorationStyle') , decoHeight :: Dimension -- ^ Height of the decorations + , windowTitleAddons :: [(String, Align)] -- ^ Extra text to appear in a window's title bar } deriving (Show, Read) -- | The default xmonad 'Theme'. @@ -94,6 +95,7 @@ defaultTheme = , fontName = "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*" , decoWidth = 200 , decoHeight = 20 + , windowTitleAddons = [] } -- | A 'Decoration' layout modifier will handle 'SetTheme', a message @@ -374,7 +376,9 @@ updateDeco sh t fs ((w,_),(Just dw,Just (Rectangle _ _ wh ht))) = do let s = shrinkIt sh name <- shrinkWhile s (\n -> do size <- io $ textWidthXMF dpy fs n return $ size > fromIntegral wh - fromIntegral (ht `div` 2)) (show nw) - paintAndWrite dw fs wh ht 1 bc borderc tc bc [AlignCenter] [name] + let als = AlignCenter : map snd (windowTitleAddons t) + strs = name : map fst (windowTitleAddons t) + paintAndWrite dw fs wh ht 1 bc borderc tc bc als strs updateDeco _ _ _ (_,(Just w,Nothing)) = hideWindow w updateDeco _ _ _ _ = return () diff --git a/XMonad/Util/Font.hsc b/XMonad/Util/Font.hsc index 5912053..a4e2b32 100644 --- a/XMonad/Util/Font.hsc +++ b/XMonad/Util/Font.hsc @@ -144,6 +144,7 @@ textExtentsXMF (Xft xftfont) _ = io $ do -- | String position data Align = AlignCenter | AlignRight | AlignLeft | AlignRightOffset Int + deriving (Show, Read) -- | Return the string x and y 'Position' in a 'Rectangle', given a -- 'FontStruct' and the 'Align'ment |