summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/App/Config.hs
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2018-11-30 05:27:53 +0000
committerjao <jao@gnu.org>2018-11-30 05:27:53 +0000
commita9df65ad952251d2f0c837add0cfe4626d321bf8 (patch)
tree14111b70e96ab310c6d70700f32f8966059adb70 /src/Xmobar/App/Config.hs
parentfa681551411e8c74e6462f6997c37fcc38335d4d (diff)
downloadxmobar-a9df65ad952251d2f0c837add0cfe4626d321bf8.tar.gz
xmobar-a9df65ad952251d2f0c837add0cfe4626d321bf8.tar.bz2
Self-compilation a la xmonad
Diffstat (limited to 'src/Xmobar/App/Config.hs')
-rw-r--r--src/Xmobar/App/Config.hs14
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