diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Xmobar/App/Config.hs | 8 | ||||
-rw-r--r-- | src/Xmobar/App/Main.hs | 9 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/Xmobar/App/Config.hs b/src/Xmobar/App/Config.hs index 8c2bef8..48209d3 100644 --- a/src/Xmobar/App/Config.hs +++ b/src/Xmobar/App/Config.hs @@ -96,8 +96,8 @@ xmobarConfigDir = -- Several directories are considered. In order of preference: -- -- 1. The directory specified in the @XMOBAR_DATA_DIR@ environment variable. --- 2. The @~\/.xmobar@ directory. --- 3. The @XDG_DATA_HOME/xmobar@ directory. +-- 2. The @XDG_DATA_HOME/xmobar@ directory. +-- 3. The @~\/.xmobar@ directory. -- -- The first directory that exists will be used. If none of the -- directories exist then (1) will be used if it is set, otherwise (2) @@ -106,8 +106,8 @@ xmobarConfigDir = xmobarDataDir :: IO String xmobarDataDir = findFirstDirWithEnv True "XMOBAR_DATA_DIR" - [ getAppUserDataDirectory "xmobar" - , getXdgDirectory XdgData "xmobar" + [ getXdgDirectory XdgData "xmobar" + , getAppUserDataDirectory "xmobar" ] -- | Helper function that will find the first existing directory and diff --git a/src/Xmobar/App/Main.hs b/src/Xmobar/App/Main.hs index 714d153..29504f4 100644 --- a/src/Xmobar/App/Main.hs +++ b/src/Xmobar/App/Main.hs @@ -70,13 +70,13 @@ cleanupThreads vars = for_ (concat vars) $ \(asyncs, _) -> for_ asyncs cancel -buildLaunch :: Bool -> Bool -> FilePath -> String -> ParseError -> IO () -buildLaunch verb force p datadir e = do +buildLaunch :: Bool -> Bool -> String -> ParseError -> IO () +buildLaunch verb force p e = do let exec = takeBaseName p confDir = takeDirectory p ext = takeExtension p if ext `elem` [".hs", ".hsc", ".lhs"] - then recompile confDir datadir exec force verb >> + then xmobarDataDir >>= \dd -> recompile confDir dd exec force verb >> executeFile (confDir </> exec) False [] Nothing else trace True ("Invalid configuration file: " ++ show e) >> trace True "\n(No compilation attempted: \ @@ -101,8 +101,7 @@ xmobarMain = do (c:_) -> error $ c ++ ": file not found" _ -> doOpts defaultConfig flags >>= xmobar Just p -> do r <- readConfig defaultConfig p - dataDir <- xmobarDataDir case r of Left e -> - buildLaunch (verboseFlag flags) (recompileFlag flags) p dataDir e + buildLaunch (verboseFlag flags) (recompileFlag flags) p e Right (c, defs) -> doOpts c flags >>= xmobar' defs |