From a9df65ad952251d2f0c837add0cfe4626d321bf8 Mon Sep 17 00:00:00 2001 From: jao Date: Fri, 30 Nov 2018 05:27:53 +0000 Subject: Self-compilation a la xmonad --- src/Xmobar/App/Config.hs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/Xmobar/App/Config.hs') 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% }{ " ++ "%uname% * %theDate%" + , 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 -- cgit v1.2.3