diff options
Diffstat (limited to 'src/Xmobar/X11/Parsers.hs')
-rw-r--r-- | src/Xmobar/X11/Parsers.hs | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/Xmobar/X11/Parsers.hs b/src/Xmobar/X11/Parsers.hs index 0685618..34d4336 100644 --- a/src/Xmobar/X11/Parsers.hs +++ b/src/Xmobar/X11/Parsers.hs @@ -14,8 +14,14 @@ -- ----------------------------------------------------------------------------- -module Xmobar.X11.Parsers (parseString, Box(..), BoxBorder(..), BoxOffset(..), - BoxMargins(..), TextRenderInfo(..), Widget(..)) where +module Xmobar.X11.Parsers ( parseString + , parseStringAsText + , Box(..) + , BoxBorder(..) + , BoxOffset(..) + , BoxMargins(..) + , TextRenderInfo(..) + , Widget(..)) where import Xmobar.Config.Types import Xmobar.X11.Actions @@ -62,6 +68,16 @@ parseString c s = Right x -> return (concat x) where ci = TextRenderInfo (fgColor c) 0 0 [] +asText :: (Widget, TextRenderInfo, FontIndex, Maybe [Action]) -> String +asText (Text s, _, _, _) = s +asText _ = "" + +parseStringAsText :: Config -> String -> IO String +parseStringAsText c s = do + chunks <- parseString c s + let txts = map asText chunks + return (concat txts) + allParsers :: TextRenderInfo -> FontIndex -> Maybe [Action] |