diff options
-rw-r--r-- | changelog.md | 9 | ||||
-rw-r--r-- | src/Xmobar/App/Main.hs | 17 | ||||
-rw-r--r-- | src/Xmobar/App/Opts.hs | 7 |
3 files changed, 23 insertions, 10 deletions
diff --git a/changelog.md b/changelog.md index d2ad8eb..01d67b9 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,12 @@ +## Version 0.29.1 (December, 2018) + +_Bug fixes_ + + - Honour command line flags (fixes [issue #370]) + - Expose Cmd and CmdX in Xmobar interface + +[issue #370]: https://github.com/jaor/xmobar/issues/370 + ## Version 0.29 (December, 2018) _New features_ diff --git a/src/Xmobar/App/Main.hs b/src/Xmobar/App/Main.hs index b5de2ef..2291852 100644 --- a/src/Xmobar/App/Main.hs +++ b/src/Xmobar/App/Main.hs @@ -73,8 +73,8 @@ buildLaunch verb force p = do recompile dir exec force verb executeFile (dir </> exec) False [] Nothing -xmobar' :: Config -> [String] -> IO () -xmobar' cfg defs = do +xmobar' :: [String] -> Config -> IO () +xmobar' defs cfg = do unless (null defs || not (verbose cfg)) $ putStrLn $ "Fields missing from config defaulted: " ++ intercalate "," defs xmobar cfg @@ -84,14 +84,15 @@ xmobarMain = do args <- getArgs (flags, rest) <- getOpts args cf <- case rest of - (c:_) -> return (Just c) - _ -> xmobarConfigFile + [c] -> return (Just c) + [] -> xmobarConfigFile + _ -> error $ "Too many arguments: " ++ show rest case cf of Nothing -> case rest of (c:_) -> error $ c ++ ": file not found" _ -> xmobar defaultConfig - Just p -> do d <- doOpts defaultConfig flags - r <- readConfig d p + Just p -> do r <- readConfig defaultConfig p case r of - Left _ -> buildLaunch (verbose d) (forceRecompile flags) p - Right (c, defs) -> xmobar' c defs + Left _ -> + buildLaunch (verboseFlag flags) (recompileFlag flags) p + Right (c, defs) -> doOpts c flags >>= xmobar' defs diff --git a/src/Xmobar/App/Opts.hs b/src/Xmobar/App/Opts.hs index 34e2c9e..07428d2 100644 --- a/src/Xmobar/App/Opts.hs +++ b/src/Xmobar/App/Opts.hs @@ -161,5 +161,8 @@ doOpts conf (o:oo) = putStrLn "Can't parse position option, ignoring" doOpts' conf -forceRecompile :: [Opts] -> Bool -forceRecompile = elem Recompile +recompileFlag :: [Opts] -> Bool +recompileFlag = elem Recompile + +verboseFlag :: [Opts] -> Bool +verboseFlag = elem Verbose |