From bc27a68eb346b5e73c530f0f9c3e62e56517e225 Mon Sep 17 00:00:00 2001 From: jao Date: Sun, 25 Nov 2018 21:48:15 +0000 Subject: Xmobar.App and small refactorings --- src/Xmobar.hs | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'src/Xmobar.hs') diff --git a/src/Xmobar.hs b/src/Xmobar.hs index b4543f6..be20dbe 100644 --- a/src/Xmobar.hs +++ b/src/Xmobar.hs @@ -47,7 +47,6 @@ import Control.Exception (bracket) import Xmobar.Config import Xmobar.Run.Runnable import Xmobar.Run.Template -import Xmobar.Run.EventLoop (startLoop, startCommand) import Xmobar.System.Signal (setupSignalHandler, withDeferSignals) import Xmobar.X11.Types import Xmobar.X11.XUtil @@ -69,19 +68,7 @@ import Xmobar.Plugins.Monitors import Xmobar.Plugins.PipeReader import Xmobar.Plugins.StdinReader import Xmobar.Plugins.XMonadLog - - -splitTemplate :: Config -> [String] -splitTemplate conf = - case break (==l) t of - (le,_:re) -> case break (==r) re of - (ce,_:ri) -> [le, ce, ri] - _ -> def - _ -> def - where [l, r] = alignSep - (if length (alignSep conf) == 2 then conf else defaultConfig) - t = template conf - def = [t, "", ""] +import Xmobar.App.EventLoop (startLoop, startCommand) xmobar :: Config -> IO () xmobar conf = withDeferSignals $ do @@ -89,7 +76,8 @@ xmobar conf = withDeferSignals $ do d <- openDisplay "" fs <- initFont d (font conf) fl <- mapM (initFont d) (additionalFonts conf) - cls <- mapM (parseCommands conf) (splitTemplate conf) + cls <- mapM (parseTemplate (commands conf) (sepChar conf)) + (splitTemplate (alignSep conf) (template conf)) sig <- setupSignalHandler bracket (mapM (mapM $ startCommand sig) cls) cleanupThreads -- cgit v1.2.3