summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/App
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2018-12-09 04:01:05 +0000
committerjao <jao@gnu.org>2018-12-09 04:01:05 +0000
commitd623087e37637bd7bfb147bb5167fadb377d031e (patch)
treedb238b065d5d8af922d56b7abbfcf5084238d3b6 /src/Xmobar/App
parent0598ade204d1b4eb53303b4a06ac660f0592a2d0 (diff)
downloadxmobar-d623087e37637bd7bfb147bb5167fadb377d031e.tar.gz
xmobar-d623087e37637bd7bfb147bb5167fadb377d031e.tar.bz2
New exposed function: configFromArgs
Diffstat (limited to 'src/Xmobar/App')
-rw-r--r--src/Xmobar/App/Main.hs7
-rw-r--r--src/Xmobar/App/Opts.hs2
2 files changed, 6 insertions, 3 deletions
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