From f2907ced81dc25bfe19ba3bd705d3b60f33ee68d Mon Sep 17 00:00:00 2001 From: slotThe Date: Tue, 6 Jul 2021 09:23:37 +0200 Subject: Filter filename when executing Haskell-based config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We are now—in case the user specified a Haskell file as their xmobar configuration—threading the command line arguments that xmobar receives to the relevant execv() call. However, we simply shove in all arguments originally given to xmobar, including the path to the configuration file. As main is now defined within that very file, this seems unneccessary. By filtering out that part of the arguments, the pattern that a lot of users seem to follow for easy setting of certain options becomes a little bit nicer. For example: main :: IO () main = getArgs >>= \case ["-x", n, _] -> xmobar . config $ read n _ -> xmobar $ config 0 becomes main :: IO () main = getArgs >>= \case ["-x", n] -> xmobar . config $ read n _ -> xmobar $ config 0 Related: https://github.com/jaor/xmobar/pull/553 --- src/Xmobar/App/Main.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Xmobar/App') diff --git a/src/Xmobar/App/Main.hs b/src/Xmobar/App/Main.hs index 16d5063..61604e0 100644 --- a/src/Xmobar/App/Main.hs +++ b/src/Xmobar/App/Main.hs @@ -106,5 +106,5 @@ xmobarMain = do Just p -> do r <- readConfig defaultConfig p case r of Left e -> - buildLaunch 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 -- cgit v1.2.3