From d623087e37637bd7bfb147bb5167fadb377d031e Mon Sep 17 00:00:00 2001 From: jao Date: Sun, 9 Dec 2018 04:01:05 +0000 Subject: New exposed function: configFromArgs --- src/Xmobar/App/Main.hs | 7 +++++-- src/Xmobar/App/Opts.hs | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src/Xmobar/App') diff --git a/src/Xmobar/App/Main.hs b/src/Xmobar/App/Main.hs index 3240df9..6eda49a 100644 --- a/src/Xmobar/App/Main.hs +++ b/src/Xmobar/App/Main.hs @@ -15,7 +15,7 @@ ------------------------------------------------------------------------------ -module Xmobar.App.Main (xmobar, xmobarMain) where +module Xmobar.App.Main (xmobar, xmobarMain, configFromArgs) where import Control.Concurrent.Async (Async, cancel) import Control.Exception (bracket) @@ -39,7 +39,7 @@ import Xmobar.Run.Template import Xmobar.X11.Types import Xmobar.X11.Text import Xmobar.X11.Window -import Xmobar.App.Opts +import Xmobar.App.Opts (recompileFlag, verboseFlag, getOpts, doOpts) import Xmobar.App.EventLoop (startLoop, startCommand) import Xmobar.App.Compile (recompile, trace) import Xmobar.App.Config @@ -62,6 +62,9 @@ xmobar conf = withDeferSignals $ do ts = textOffsets conf ++ replicate (length fl) (-1) startLoop (XConf d r w (fs:fl) (to:ts) ic conf) sig vars +configFromArgs :: Config -> IO Config +configFromArgs cfg = getArgs >>= getOpts >>= doOpts cfg . fst + cleanupThreads :: [[([Async ()], a)]] -> IO () cleanupThreads vars = for_ (concat vars) $ \(asyncs, _) -> diff --git a/src/Xmobar/App/Opts.hs b/src/Xmobar/App/Opts.hs index 07428d2..46a3ab6 100644 --- a/src/Xmobar/App/Opts.hs +++ b/src/Xmobar/App/Opts.hs @@ -14,7 +14,7 @@ -- ------------------------------------------------------------------------------ -module Xmobar.App.Opts where +module Xmobar.App.Opts (recompileFlag, verboseFlag, getOpts, doOpts) where import Control.Monad (when) import System.Console.GetOpt -- cgit v1.2.3