summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/Main.hs17
-rw-r--r--xmobar.cabal3
2 files changed, 16 insertions, 4 deletions
diff --git a/src/Main.hs b/src/Main.hs
index aad2804..e90a158 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -32,9 +32,10 @@ import Paths_xmobar (version)
import Data.Version (showVersion)
import Graphics.X11.Xlib
import System.Console.GetOpt
+import System.Directory (getHomeDirectory)
import System.Exit
import System.Environment
-import System.Environment.XDG.BaseDir
+import System.FilePath ((</>))
import System.Posix.Files
import Control.Monad (unless)
@@ -89,10 +90,22 @@ readConfig f = do
": configuration file contains errors at:\n" ++ show err)
return $ parseConfig s
+xdgConfigDir :: IO String
+xdgConfigDir = do env <- getEnvironment
+ case lookup "XDG_CONFIG_HOME" env of
+ Just val -> return val
+ Nothing -> getHomeDirectory >>= return . (</> ".config")
+
+xmobarConfigDir :: IO FilePath
+xmobarConfigDir = xdgConfigDir >>= return . (</> "xmobar")
+
+getXdgConfigFile :: IO FilePath
+getXdgConfigFile = xmobarConfigDir >>= return . (</> "xmobarrc")
+
-- | Read default configuration file or load the default config
readDefaultConfig :: IO (Config,[String])
readDefaultConfig = do
- xdgconf <- getUserDataFile "xmobar" "xmobarrc"
+ xdgconf <- getXdgConfigFile
x <- io $ fileExist xdgconf
home <- io $ getEnv "HOME"
let path = home ++ "/.xmobarrc"
diff --git a/xmobar.cabal b/xmobar.cabal
index de80bbf..2ba7e57 100644
--- a/xmobar.cabal
+++ b/xmobar.cabal
@@ -108,8 +108,7 @@ executable xmobar
X11 >= 1.6.1,
mtl >= 2.0 && < 2.2,
parsec == 3.1.*,
- stm >= 2.3 && < 2.5,
- xdg-basedir == 0.2.*
+ stm >= 2.3 && < 2.5
if flag(with_threaded)
-- -threaded is a workaround for 100% CPU busy loop