summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBen Boeckel <mathstuf@gmail.com>2013-03-19 15:03:00 -0400
committerBen Boeckel <mathstuf@gmail.com>2013-07-04 23:49:08 -0400
commit7b0d6bffd5c13234feb798604e01fa6a6f91ec6b (patch)
tree637fdf9a4f61b4ef572e4d093efb84ee954cd442
parentc21d8e8870d7e092cd24dcc2bc7a70c2564a3217 (diff)
downloadxmobar-7b0d6bffd5c13234feb798604e01fa6a6f91ec6b.tar.gz
xmobar-7b0d6bffd5c13234feb798604e01fa6a6f91ec6b.tar.bz2
Support xmobarrc living in XDG_CONFIG_HOME
-rw-r--r--src/Main.hs7
-rw-r--r--xmobar.cabal3
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