diff options
author | Joey Hess <joey@kitenet.net> | 2012-08-01 23:31:53 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-08-01 23:31:53 -0400 |
commit | 23fe661d37ceb6c7bf754e9dc8fd5dda89793b63 (patch) | |
tree | 108b4708b87dc3b4b44d5737a6154be458f307dc /Build/InstallDesktopFile.hs | |
parent | ffeb060002cd33b7db0fc03b1abacc7b2762b88e (diff) |
install autostart file too
Diffstat (limited to 'Build/InstallDesktopFile.hs')
-rw-r--r-- | Build/InstallDesktopFile.hs | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/Build/InstallDesktopFile.hs b/Build/InstallDesktopFile.hs index b4a56a2cb..a08743f3d 100644 --- a/Build/InstallDesktopFile.hs +++ b/Build/InstallDesktopFile.hs @@ -1,4 +1,5 @@ -{- Generating and installing a desktop menu entry file. +{- Generating and installing a desktop menu entry file + - and a desktop autostart file. - - Copyright 2012 Joey Hess <joey@kitenet.net> - @@ -24,16 +25,28 @@ desktop command = genDesktopEntry (command ++ " webapp") ["Network", "FileTransfer"] -writeDesktop :: DesktopEntry -> IO () -writeDesktop d = do +autostart :: FilePath -> DesktopEntry +autostart command = genDesktopEntry + "Git Annex Assistant" + "Autostart" + False + (command ++ " assistant --autostart") + [] + +writeDesktop :: String -> IO () +writeDesktop command = do destdir <- catchDefaultIO (getEnv "DESTDIR") "" uid <- fromIntegral <$> getRealUserID - dest <- if uid /= 0 - then userDesktopMenuFilePath "git-annex" - else return $ systemDesktopMenuFilePath "git-annex" - writeDesktopMenuFile d dest + + datadir <- if uid /= 0 then userDataDir else return systemDataDir + writeDesktopMenuFile (desktop command) $ + desktopMenuFilePath "git-annex" datadir + + configdir <- if uid /= 0 then userConfigDir else return systemConfigDir + writeDesktopMenuFile (autostart command) $ + autoStartPath "git-annex" configdir main = getArgs >>= go where go [] = error "specify git-annex command" - go (command:_) = writeDesktop $ desktop command + go (command:_) = writeDesktop command |