summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Main.hs16
1 files changed, 9 insertions, 7 deletions
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