diff options
Diffstat (limited to 'src/Xmobar/App/Config.hs')
-rw-r--r-- | src/Xmobar/App/Config.hs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/Xmobar/App/Config.hs b/src/Xmobar/App/Config.hs index 7b1171f..431ee10 100644 --- a/src/Xmobar/App/Config.hs +++ b/src/Xmobar/App/Config.hs @@ -61,6 +61,7 @@ defaultConfig = , alignSep = "}{" , template = "%StdinReader% }{ " ++ "<fc=#00FF00>%uname%</fc> * <fc=#FF0000>%theDate%</fc>" + , verbose = False } -- | Return the path to the xmobar configuration directory. This @@ -136,8 +137,11 @@ findFirstDirWithEnv envName paths = do Nothing -> findFirstDirOf paths Just envPath -> findFirstDirOf (return envPath:paths) -xmobarConfigFile :: IO FilePath -xmobarConfigFile = do - f <- fmap (</> "xmobarrc") xmobarConfigDir - fe <- fileExist f - if fe then return f else fmap (</> ".xmobarrc") getHomeDirectory +xmobarConfigFile :: IO (Maybe FilePath) +xmobarConfigFile = + ffirst [ xdg "xmobar.hs", xdg "xmobarrc", home ".xmobarrc"] + where xdg p = fmap (</> p) xmobarConfigDir + home p = fmap (</> p) getHomeDirectory + ffirst [] = return Nothing + ffirst (f:fs) = + f >>= fileExist >>= \e -> if e then fmap Just f else ffirst fs |