diff options
Diffstat (limited to 'src/Xmobar/Text')
-rw-r--r-- | src/Xmobar/Text/Loop.hs | 2 | ||||
-rw-r--r-- | src/Xmobar/Text/Output.hs | 24 | ||||
-rw-r--r-- | src/Xmobar/Text/Swaybar.hs | 20 |
3 files changed, 24 insertions, 22 deletions
diff --git a/src/Xmobar/Text/Loop.hs b/src/Xmobar/Text/Loop.hs index 05379cd..5d2c43f 100644 --- a/src/Xmobar/Text/Loop.hs +++ b/src/Xmobar/Text/Loop.hs @@ -45,4 +45,4 @@ eventLoop cfg signal tv = do updateString :: Config -> TVar [String] -> IO String updateString conf v = do s <- readTVarIO v - format conf (concat s) + return $ format conf (concat s) diff --git a/src/Xmobar/Text/Output.hs b/src/Xmobar/Text/Output.hs index 783a5bb..677b6d2 100644 --- a/src/Xmobar/Text/Output.hs +++ b/src/Xmobar/Text/Output.hs @@ -15,13 +15,15 @@ module Xmobar.Text.Output (initLoop, format) where -import Xmobar.Config.Types (Config(textOutputFormat, additionalFonts, font) - , TextOutputFormat(..)) -import Xmobar.Run.Parsers ( Segment - , Widget(..) - , parseString - , tColorsString - , colorComponents) +import Xmobar.Config.Types ( Config (..) + , TextOutputFormat (..) + , Segment + , Widget (..) + , tColorsString) + + +import Xmobar.Config.Parse (colorComponents) +import Xmobar.Config.Template (parseString) import Xmobar.Text.Ansi (withAnsiColor) import Xmobar.Text.Pango (withPangoMarkup) @@ -47,9 +49,9 @@ formatWithColor conf (Hspace n, i, x, y) = formatWithColor conf (Text $ replicate (fromIntegral n) ' ', i, x, y) formatWithColor _ _ = "" -format :: Config -> String -> IO String +format :: Config -> String -> String format conf s = do - segments <- parseString conf s + let segments = parseString conf s case textOutputFormat conf of - Swaybar -> return $ formatSwaybar conf segments - _ -> return (concatMap (formatWithColor conf) segments) + Swaybar -> formatSwaybar conf segments + _ -> concatMap (formatWithColor conf) segments diff --git a/src/Xmobar/Text/Swaybar.hs b/src/Xmobar/Text/Swaybar.hs index a2fc585..355de06 100644 --- a/src/Xmobar/Text/Swaybar.hs +++ b/src/Xmobar/Text/Swaybar.hs @@ -24,16 +24,16 @@ import Data.ByteString.Lazy.UTF8 (toString) import GHC.Generics -import Xmobar.Config.Types (Config (additionalFonts)) - -import Xmobar.Run.Parsers ( Segment - , Widget(..) - , Box(..) - , BoxBorder(..) - , FontIndex - , tBoxes - , tColorsString - , colorComponents) +import Xmobar.Config.Types ( Config (additionalFonts) + , Segment + , Widget(..) + , Box(..) + , BoxBorder(..) + , FontIndex + , tBoxes + , tColorsString) + +import Xmobar.Config.Parse (colorComponents) import Xmobar.Text.SwaybarClicks (startHandler) import Xmobar.Text.Pango (withPangoFont) |