summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/X11/Parsers.hs
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-01-28 03:46:49 +0000
committerjao <jao@gnu.org>2022-01-29 06:42:29 +0000
commit93da696658061e1c14fdca70b6c0f04c412b1fd8 (patch)
treec53b24ab8cf60419d2a224fe279dfc2e9ac2ac71 /src/Xmobar/X11/Parsers.hs
parent06e5c61ff84bae540ce16ca17abb94c703546acd (diff)
downloadxmobar-93da696658061e1c14fdca70b6c0f04c412b1fd8.tar.gz
xmobar-93da696658061e1c14fdca70b6c0f04c412b1fd8.tar.bz2
Basic Xmobar.App.TextEventLoop
Diffstat (limited to 'src/Xmobar/X11/Parsers.hs')
-rw-r--r--src/Xmobar/X11/Parsers.hs20
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]