diff options
author | jao <jao@gnu.org> | 2018-12-09 04:01:05 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2018-12-09 04:01:05 +0000 |
commit | d623087e37637bd7bfb147bb5167fadb377d031e (patch) | |
tree | db238b065d5d8af922d56b7abbfcf5084238d3b6 | |
parent | 0598ade204d1b4eb53303b4a06ac660f0592a2d0 (diff) | |
download | xmobar-d623087e37637bd7bfb147bb5167fadb377d031e.tar.gz xmobar-d623087e37637bd7bfb147bb5167fadb377d031e.tar.bz2 |
New exposed function: configFromArgs
-rw-r--r-- | src/Xmobar.hs | 3 | ||||
-rw-r--r-- | src/Xmobar/App/Main.hs | 7 | ||||
-rw-r--r-- | src/Xmobar/App/Opts.hs | 2 |
3 files changed, 8 insertions, 4 deletions
diff --git a/src/Xmobar.hs b/src/Xmobar.hs index cd58ab1..2707a66 100644 --- a/src/Xmobar.hs +++ b/src/Xmobar.hs @@ -18,6 +18,7 @@ module Xmobar (xmobar , xmobarMain , defaultConfig + , configFromArgs , Runnable (..) , Exec (..) , Command (..) @@ -65,5 +66,5 @@ import Xmobar.Plugins.PipeReader import Xmobar.Plugins.StdinReader import Xmobar.Plugins.XMonadLog -import Xmobar.App.Main(xmobar, xmobarMain) +import Xmobar.App.Main(xmobar, xmobarMain, configFromArgs) import Xmobar.App.Config(defaultConfig) 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 |