summaryrefslogtreecommitdiff
path: root/Utility/FreeDesktop.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Utility/FreeDesktop.hs')
-rw-r--r--Utility/FreeDesktop.hs29
1 files changed, 19 insertions, 10 deletions
diff --git a/Utility/FreeDesktop.hs b/Utility/FreeDesktop.hs
index 5e38d382d..5bab4950a 100644
--- a/Utility/FreeDesktop.hs
+++ b/Utility/FreeDesktop.hs
@@ -14,8 +14,12 @@ module Utility.FreeDesktop (
genDesktopEntry,
buildDesktopMenuFile,
writeDesktopMenuFile,
- userDesktopMenuFilePath,
- systemDesktopMenuFilePath
+ desktopMenuFilePath,
+ autoStartPath,
+ systemDataDir,
+ systemConfigDir,
+ userDataDir,
+ userConfigDir
) where
import Utility.Exception
@@ -70,18 +74,23 @@ writeDesktopMenuFile d file = do
createDirectoryIfMissing True (parentDir file)
writeFile file $ buildDesktopMenuFile d
-userDesktopMenuFilePath :: String -> IO FilePath
-userDesktopMenuFilePath basename = do
- datadir <- userDataDir
- return $ datadir </> "applications" </> desktopfile basename
+desktopMenuFilePath :: String -> FilePath -> FilePath
+desktopMenuFilePath basename datadir =
+ datadir </> "applications" </> desktopfile basename
-systemDesktopMenuFilePath :: String -> FilePath
-systemDesktopMenuFilePath basename =
- "/usr/share/applications" </> desktopfile basename
+autoStartPath :: String -> FilePath -> FilePath
+autoStartPath basename configdir =
+ configdir </> "autostart" </> desktopfile basename
desktopfile :: FilePath -> FilePath
desktopfile f = f ++ ".desktop"
+systemDataDir :: FilePath
+systemDataDir = "/usr/share"
+
+systemConfigDir :: FilePath
+systemConfigDir = "/etc/xdg"
+
userDataDir :: IO FilePath
userDataDir = do
dir <- xdgEnv "DATA_HOME" =<< myHomeDir
@@ -89,7 +98,7 @@ userDataDir = do
userConfigDir :: IO FilePath
userConfigDir = do
- dir <- xdgEnv "DATA_HOME" =<< myHomeDir
+ dir <- xdgEnv "CONFIG_HOME" =<< myHomeDir
return $ dir </> ".config"
xdgEnv :: String -> String -> IO String