aboutsummaryrefslogtreecommitdiff
path: root/Utility/FreeDesktop.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-08-01 20:49:02 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-08-01 20:49:02 -0400
commit9422e274897eb7581f453cb4374c326f0bf83d4f (patch)
treefe5e08c58dff5cdac8c3f63e214b85d217981b2e /Utility/FreeDesktop.hs
parent89ec253a6a02addca9293815966454a9646dcf0d (diff)
installing desktop file working
Not hooked up to either Makefile or cabal yet
Diffstat (limited to 'Utility/FreeDesktop.hs')
-rw-r--r--Utility/FreeDesktop.hs18
1 files changed, 10 insertions, 8 deletions
diff --git a/Utility/FreeDesktop.hs b/Utility/FreeDesktop.hs
index ce3501766..5e38d382d 100644
--- a/Utility/FreeDesktop.hs
+++ b/Utility/FreeDesktop.hs
@@ -9,7 +9,7 @@
- Licensed under the GNU GPL version 3 or higher.
-}
-module Utility.DesktopMenu (
+module Utility.FreeDesktop (
DesktopEntry,
genDesktopEntry,
buildDesktopMenuFile,
@@ -47,16 +47,14 @@ toString (ListV l)
where
escapesemi = join "\\;" . split ";"
-genDesktopEntry :: String -> String -> Bool -> FilePath -> FilePath -> [String] -> DesktopEntry
-genDesktopEntry name comment terminal program icon categories =
- [ item "Encoding" StringV "UTF-8"
- , item "Type" StringV "Application"
+genDesktopEntry :: String -> String -> Bool -> FilePath -> [String] -> DesktopEntry
+genDesktopEntry name comment terminal program categories =
+ [ item "Type" StringV "Application"
, item "Version" NumericV 1.0
, item "Name" StringV name
, item "Comment" StringV comment
, item "Terminal" BoolV terminal
, item "Exec" StringV program
- , item "Icon" StringV icon
, item "Categories" ListV (map StringV categories)
]
where
@@ -75,10 +73,14 @@ writeDesktopMenuFile d file = do
userDesktopMenuFilePath :: String -> IO FilePath
userDesktopMenuFilePath basename = do
datadir <- userDataDir
- return $ datadir </> "applications" </> basename
+ return $ datadir </> "applications" </> desktopfile basename
systemDesktopMenuFilePath :: String -> FilePath
-systemDesktopMenuFilePath basename = "/usr/share/applications" </> basename
+systemDesktopMenuFilePath basename =
+ "/usr/share/applications" </> desktopfile basename
+
+desktopfile :: FilePath -> FilePath
+desktopfile f = f ++ ".desktop"
userDataDir :: IO FilePath
userDataDir = do