aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBraden Shepherdson <Braden.Shepherdson@gmail.com>2009-03-14 04:28:18 +0100
committerBraden Shepherdson <Braden.Shepherdson@gmail.com>2009-03-14 04:28:18 +0100
commit49f103cfdf558e469774b0a5e668823fdf11a91c (patch)
tree6b549b955e41590c5687a001592fa47caa8f9552
parentb16d857323972c9a42e8d997b2baf510ba415f34 (diff)
downloadXMonadContrib-49f103cfdf558e469774b0a5e668823fdf11a91c.tar.gz
XMonadContrib-49f103cfdf558e469774b0a5e668823fdf11a91c.tar.xz
XMonadContrib-49f103cfdf558e469774b0a5e668823fdf11a91c.zip
X.H.DynamicLog: Add dzenStrip to remove formatting, for use in dzenPP's ppUrgent.
Ignore-this: fd96a1a4b112d0f71589b639b83ec3e This function was written by Wirt Wolff. This change should allow UrgencyHook to work out of the box with dzen and dzenPP, rather than the colours being overridden so even though UrgencyHook is working, it doesn't change colours. darcs-hash:20090314032818-d53a8-7af4c3e0cb04eca34d7d95cdd28a3e727a1abd83.gz
-rw-r--r--XMonad/Hooks/DynamicLog.hs15
1 files changed, 13 insertions, 2 deletions
diff --git a/XMonad/Hooks/DynamicLog.hs b/XMonad/Hooks/DynamicLog.hs
index b599783..b4bbe48 100644
--- a/XMonad/Hooks/DynamicLog.hs
+++ b/XMonad/Hooks/DynamicLog.hs
@@ -39,7 +39,7 @@ module XMonad.Hooks.DynamicLog (
-- * Formatting utilities
wrap, pad, shorten,
- xmobarColor, dzenColor, dzenEscape,
+ xmobarColor, dzenColor, dzenEscape, dzenStrip,
-- * Internal formatting functions
pprWindowSet,
@@ -332,6 +332,17 @@ dzenColor fg bg = wrap (fg1++bg1) (fg2++bg2)
dzenEscape :: String -> String
dzenEscape = concatMap (\x -> if x == '^' then "^^" else [x])
+-- | Strip dzen formatting (used in ppUrgent)
+dzenStrip :: String -> String
+dzenStrip = strip [] where
+ strip keep [] = keep
+ strip keep ('^':'^':x) = strip (keep ++ "^") x
+ strip keep ('^':x) = strip keep (drop 1 . dropWhile (')' /=) $ x)
+ strip keep x = let (good,x') = span ('^' /=) x
+ in strip (keep ++ good) x'
+
+
+
-- | Use xmobar escape codes to output a string with given foreground
-- and background colors.
xmobarColor :: String -- ^ foreground color: a color name, or #rrggbb format
@@ -421,7 +432,7 @@ dzenPP = defaultPP { ppCurrent = dzenColor "white" "#2b4f98" . pad
, ppVisible = dzenColor "black" "#999999" . pad
, ppHidden = dzenColor "black" "#cccccc" . pad
, ppHiddenNoWindows = const ""
- , ppUrgent = dzenColor "red" "yellow"
+ , ppUrgent = dzenColor "red" "yellow" . dzenStrip
, ppWsSep = ""
, ppSep = ""
, ppLayout = dzenColor "black" "#cccccc" .