From a5c35003c88c4b050e56cfb5d93a0e0d77d9c223 Mon Sep 17 00:00:00 2001 From: jao Date: Fri, 28 Jan 2022 02:45:00 +0000 Subject: Whitespace --- src/Xmobar/App/EventLoop.hs | 21 +++++++++++++-------- src/Xmobar/App/Main.hs | 13 +++++++------ src/Xmobar/X11/Parsers.hs | 8 ++++---- 3 files changed, 24 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/Xmobar/App/EventLoop.hs b/src/Xmobar/App/EventLoop.hs index ae68e96..f046647 100644 --- a/src/Xmobar/App/EventLoop.hs +++ b/src/Xmobar/App/EventLoop.hs @@ -2,8 +2,8 @@ ------------------------------------------------------------------------------ -- | --- Module: Xmobar.X11.EventLoop --- Copyright: (c) 2018, 2020 Jose Antonio Ortega Ruiz +-- Module: Xmobar.App.EventLoop +-- Copyright: (c) 2018, 2020, 2022 Jose Antonio Ortega Ruiz -- License: BSD3-style (see LICENSE) -- -- Maintainer: jao@gnu.org @@ -249,21 +249,26 @@ startCommand sig (com,s,ss) return ([a1, a2], var) where is = s ++ "Updating..." ++ ss -updateString :: Config -> TVar [String] - -> IO [[(Widget, TextRenderInfo, Int, Maybe [Action])]] +updateString :: Config + -> TVar [String] + -> IO [[(Widget, TextRenderInfo, Int, Maybe [Action])]] updateString conf v = do s <- readTVarIO v let l:c:r:_ = s ++ repeat "" liftIO $ mapM (parseString conf) [l, c, r] -updateActions :: XConf -> Rectangle -> [[(Widget, TextRenderInfo, Int, Maybe [Action])]] - -> IO [([Action], Position, Position)] +updateActions :: XConf + -> Rectangle + -> [[(Widget, TextRenderInfo, Int, Maybe [Action])]] + -> IO [([Action], Position, Position)] updateActions conf (Rectangle _ _ wid _) ~[left,center,right] = do let (d,fs) = (display &&& fontListS) conf - strLn :: [(Widget, TextRenderInfo, Int, Maybe [Action])] -> IO [(Maybe [Action], Position, Position)] + strLn :: [(Widget, TextRenderInfo, Int, Maybe [Action])] + -> IO [(Maybe [Action], Position, Position)] strLn = liftIO . mapM getCoords iconW i = maybe 0 Bitmap.width (lookup i $ iconS conf) - getCoords (Text s,_,i,a) = textWidth d (safeIndex fs i) s >>= \tw -> return (a, 0, fi tw) + getCoords (Text s,_,i,a) = + textWidth d (safeIndex fs i) s >>= \tw -> return (a, 0, fi tw) getCoords (Icon s,_,_,a) = return (a, 0, fi $ iconW s) getCoords (Hspace w,_,_,a) = return (a, 0, fi w) partCoord off xs = map (\(a, x, x') -> (fromJust a, x, x')) $ diff --git a/src/Xmobar/App/Main.hs b/src/Xmobar/App/Main.hs index d969cc5..6a3203f 100644 --- a/src/Xmobar/App/Main.hs +++ b/src/Xmobar/App/Main.hs @@ -1,7 +1,7 @@ ------------------------------------------------------------------------------ -- | -- Module: Xmobar.App.Main --- Copyright: (c) 2018, 2019, 2020 Jose Antonio Ortega Ruiz +-- Copyright: (c) 2018, 2019, 2020, 2022 Jose Antonio Ortega Ruiz -- License: BSD3-style (see LICENSE) -- -- Maintainer: jao@gnu.org @@ -51,12 +51,12 @@ xmobar :: Config -> IO () xmobar conf = withDeferSignals $ do initThreads d <- openDisplay "" - fs <- initFont d (font conf) - fl <- mapM (initFont d) (additionalFonts conf) - cls <- mapM (parseTemplate (commands conf) (sepChar conf)) + fs <- initFont d (font conf) + fl <- mapM (initFont d) (additionalFonts conf) + cls <- mapM (parseTemplate (commands conf) (sepChar conf)) (splitTemplate (alignSep conf) (template conf)) let confSig = unSignalChan (signal conf) - sig <- maybe newEmptyTMVarIO pure confSig + sig <- maybe newEmptyTMVarIO pure confSig unless (isJust confSig) $ setupSignalHandler sig refLock <- newRefreshLock withTimer (refreshLock refLock) $ @@ -110,5 +110,6 @@ xmobarMain = do Just p -> do r <- readConfig defaultConfig p case r of Left e -> - buildLaunch (filter (/= p) args) (verboseFlag flags) (recompileFlag flags) p e + buildLaunch (filter (/= p) args) (verboseFlag flags) + (recompileFlag flags) p e Right (c, defs) -> doOpts c flags >>= xmobar' defs diff --git a/src/Xmobar/X11/Parsers.hs b/src/Xmobar/X11/Parsers.hs index 513f63b..0685618 100644 --- a/src/Xmobar/X11/Parsers.hs +++ b/src/Xmobar/X11/Parsers.hs @@ -193,16 +193,16 @@ boxReader b (x:xs) = do (p,'=':v) -> (p, v) (p, _) -> (p, "") boxReader (boxParamReader b param val) xs - + boxParamReader :: Box -> String -> String -> Box boxParamReader b _ "" = b -boxParamReader (Box bb off lw fc mgs) "type" val = +boxParamReader (Box bb off lw fc mgs) "type" val = Box (fromMaybe bb $ readMaybe ("BB" ++ val)) off lw fc mgs boxParamReader (Box bb (BoxOffset alg off) lw fc mgs) "offset" (a:o) = Box bb (BoxOffset (fromMaybe alg $ readMaybe [a]) (fromMaybe off $ readMaybe o)) lw fc mgs -boxParamReader (Box bb off lw fc mgs) "width" val = +boxParamReader (Box bb off lw fc mgs) "width" val = Box bb off (fromMaybe lw $ readMaybe val) fc mgs -boxParamReader (Box bb off lw _ mgs) "color" val = +boxParamReader (Box bb off lw _ mgs) "color" val = Box bb off lw val mgs boxParamReader (Box bb off lw fc mgs@(BoxMargins mt mr mb ml)) ('m':pos) val = do let mgs' = case pos of -- cgit v1.2.3