diff options
author | Ben Boeckel <mathstuf@gmail.com> | 2013-03-19 15:03:00 -0400 |
---|---|---|
committer | Ben Boeckel <mathstuf@gmail.com> | 2013-07-04 23:49:08 -0400 |
commit | 7b0d6bffd5c13234feb798604e01fa6a6f91ec6b (patch) | |
tree | 637fdf9a4f61b4ef572e4d093efb84ee954cd442 /src | |
parent | c21d8e8870d7e092cd24dcc2bc7a70c2564a3217 (diff) | |
download | xmobar-7b0d6bffd5c13234feb798604e01fa6a6f91ec6b.tar.gz xmobar-7b0d6bffd5c13234feb798604e01fa6a6f91ec6b.tar.bz2 |
Support xmobarrc living in XDG_CONFIG_HOME
Diffstat (limited to 'src')
-rw-r--r-- | src/Main.hs | 7 |
1 files changed, 6 insertions, 1 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 |