From 6e124f046b5b92dd3cdfc4a4ea337e3aca4c025d Mon Sep 17 00:00:00 2001 From: jao Date: Fri, 4 Feb 2022 05:53:48 +0000 Subject: swaybar-protocol: very basic format --- src/Xmobar/Text/Loop.hs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'src/Xmobar/Text/Loop.hs') diff --git a/src/Xmobar/Text/Loop.hs b/src/Xmobar/Text/Loop.hs index 2903aa9..89295fd 100644 --- a/src/Xmobar/Text/Loop.hs +++ b/src/Xmobar/Text/Loop.hs @@ -19,21 +19,19 @@ module Xmobar.Text.Loop (textLoop) where import Prelude hiding (lookup) import System.IO -import Control.Monad.Reader - import Control.Concurrent.STM import Xmobar.System.Signal import Xmobar.Config.Types (Config) import Xmobar.Run.Loop (loop) -import Xmobar.Run.Parsers (parseString) -import Xmobar.Text.Output (formatSegment) +import Xmobar.Text.Output (initLoop, format) -- | Starts the main event loop and threads textLoop :: Config -> IO () textLoop conf = do hSetBuffering stdin LineBuffering hSetBuffering stdout LineBuffering + initLoop conf loop conf (eventLoop conf) -- | Continuously wait for a signal from a thread or a interrupt handler @@ -47,11 +45,4 @@ eventLoop cfg signal tv = do updateString :: Config -> TVar [String] -> IO String updateString conf v = do s <- readTVarIO v - let l:c:r:_ = s ++ repeat "" - liftIO $ concat `fmap` mapM (parseStringAsText conf) [l, c, r] - -parseStringAsText :: Config -> String -> IO String -parseStringAsText c s = do - segments <- parseString c s - let txts = map (formatSegment c) segments - return (concat txts) + format conf (concat s) -- cgit v1.2.3