summaryrefslogtreecommitdiffhomepage
path: root/src/lib/Xmobar/Config.hs
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2018-11-25 00:58:21 +0000
committerjao <jao@gnu.org>2018-11-25 00:58:21 +0000
commit0b7b43ef83a2ab6fd894c20e028b9d69372c7266 (patch)
tree8ce2b4d7efbd97bca387cbf7613ca9863a14d59e /src/lib/Xmobar/Config.hs
parent7d11e5b47d06d38b23fc1190aba640de9daa76e0 (diff)
downloadxmobar-0b7b43ef83a2ab6fd894c20e028b9d69372c7266.tar.gz
xmobar-0b7b43ef83a2ab6fd894c20e028b9d69372c7266.tar.bz2
Plugins.Utils -> Utils
Diffstat (limited to 'src/lib/Xmobar/Config.hs')
-rw-r--r--src/lib/Xmobar/Config.hs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/lib/Xmobar/Config.hs b/src/lib/Xmobar/Config.hs
index 21b29fa..364ce17 100644
--- a/src/lib/Xmobar/Config.hs
+++ b/src/lib/Xmobar/Config.hs
@@ -21,8 +21,12 @@ module Xmobar.Config
, XPosition (..), Align (..), Border(..)
, defaultConfig
, runnableTypes
+ , getXdgConfigFile
) where
+import System.Environment
+import System.Directory (getHomeDirectory)
+import System.FilePath ((</>))
import Xmobar.Commands
import {-# SOURCE #-} Xmobar.Runnable
@@ -168,3 +172,15 @@ runnableTypes :: Command :*: Monitors :*: Date :*: PipeReader :*:
#endif
MarqueePipeReader :*: ()
runnableTypes = undefined
+
+xdgConfigDir :: IO String
+xdgConfigDir = do env <- getEnvironment
+ case lookup "XDG_CONFIG_HOME" env of
+ Just val -> return val
+ Nothing -> fmap (</> ".config") getHomeDirectory
+
+xmobarConfigDir :: IO FilePath
+xmobarConfigDir = fmap (</> "xmobar") xdgConfigDir
+
+getXdgConfigFile :: IO FilePath
+getXdgConfigFile = fmap (</> "xmobarrc") xmobarConfigDir