From 93da696658061e1c14fdca70b6c0f04c412b1fd8 Mon Sep 17 00:00:00 2001 From: jao Date: Fri, 28 Jan 2022 03:46:49 +0000 Subject: Basic Xmobar.App.TextEventLoop --- src/Xmobar/X11/Parsers.hs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/Xmobar/X11') 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] -- cgit v1.2.3