From 1563fa8473d728486b7c86a1a4f818466ab64413 Mon Sep 17 00:00:00 2001 From: Thiago Negri Date: Tue, 29 Oct 2013 21:40:50 -0200 Subject: Fixed #133: xmobar was not reading ~/.xmobarrc --- src/Main.hs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/Main.hs b/src/Main.hs index d0fe4fc..a3c60c3 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -105,14 +105,16 @@ getXdgConfigFile = xmobarConfigDir >>= return . ( "xmobarrc") -- | Read default configuration file or load the default config readDefaultConfig :: IO (Config,[String]) readDefaultConfig = do - xdgconf <- getXdgConfigFile - x <- io $ fileExist xdgconf + xdgConfigFile <- getXdgConfigFile + xdgConfigFileExists <- io $ fileExist xdgConfigFile home <- io $ getEnv "HOME" - let path = home ++ "/.xmobarrc" - f <- io $ fileExist xdgconf - if x then readConfig path - else if f then readConfig path - else return (defaultConfig,[]) + let defaultConfigFile = home ++ "/.xmobarrc" + defaultConfigFileExists <- io $ fileExist defaultConfigFile + if xdgConfigFileExists + then readConfig xdgConfigFile + else if defaultConfigFileExists + then readConfig defaultConfigFile + else return (defaultConfig,[]) data Opts = Help | Version -- cgit v1.2.3