diff options
-rw-r--r-- | src/Main.hs | 7 | ||||
-rw-r--r-- | xmobar.cabal | 3 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/Main.hs b/src/Main.hs index 90cd842..aad2804 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -34,6 +34,7 @@ import Graphics.X11.Xlib import System.Console.GetOpt import System.Exit import System.Environment +import System.Environment.XDG.BaseDir import System.Posix.Files import Control.Monad (unless) @@ -91,10 +92,14 @@ readConfig f = do -- | Read default configuration file or load the default config readDefaultConfig :: IO (Config,[String]) readDefaultConfig = do + xdgconf <- getUserDataFile "xmobar" "xmobarrc" + x <- io $ fileExist xdgconf home <- io $ getEnv "HOME" let path = home ++ "/.xmobarrc" f <- io $ fileExist path - if f then readConfig path else return (defaultConfig,[]) + if x then readConfig path + else if f then readConfig path + else return (defaultConfig,[]) data Opts = Help | Version diff --git a/xmobar.cabal b/xmobar.cabal index 2ba7e57..de80bbf 100644 --- a/xmobar.cabal +++ b/xmobar.cabal @@ -108,7 +108,8 @@ executable xmobar X11 >= 1.6.1, mtl >= 2.0 && < 2.2, parsec == 3.1.*, - stm >= 2.3 && < 2.5 + stm >= 2.3 && < 2.5, + xdg-basedir == 0.2.* if flag(with_threaded) -- -threaded is a workaround for 100% CPU busy loop |