2012-09-28 23:08:13 +00:00
|
|
|
{- Assistant autostart file installation
|
2012-09-26 21:19:45 +00:00
|
|
|
-
|
|
|
|
- Copyright 2012 Joey Hess <joey@kitenet.net>
|
|
|
|
-
|
|
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
|
|
-}
|
|
|
|
|
2012-09-28 23:08:13 +00:00
|
|
|
{-# LANGUAGE CPP #-}
|
|
|
|
|
2012-09-26 21:19:45 +00:00
|
|
|
module Assistant.Install.AutoStart where
|
|
|
|
|
2012-09-28 23:08:13 +00:00
|
|
|
import Utility.FreeDesktop
|
2012-09-28 23:18:08 +00:00
|
|
|
#ifdef darwin_HOST_OS
|
2012-09-26 21:19:45 +00:00
|
|
|
import Utility.OSX
|
|
|
|
import Utility.Path
|
|
|
|
import System.Directory
|
2012-09-28 23:18:08 +00:00
|
|
|
#endif
|
2012-09-26 21:19:45 +00:00
|
|
|
|
|
|
|
installAutoStart :: FilePath -> FilePath -> IO ()
|
|
|
|
installAutoStart command file = do
|
2012-09-28 23:08:13 +00:00
|
|
|
#ifdef darwin_HOST_OS
|
2012-09-26 21:19:45 +00:00
|
|
|
createDirectoryIfMissing True (parentDir file)
|
2012-09-28 23:08:13 +00:00
|
|
|
writeFile file $ genOSXAutoStartFile osxAutoStartLabel command
|
2012-09-26 21:19:45 +00:00
|
|
|
["assistant", "--autostart"]
|
2012-09-28 23:08:13 +00:00
|
|
|
#else
|
|
|
|
writeDesktopMenuFile (fdoAutostart command) file
|
|
|
|
#endif
|
|
|
|
|
|
|
|
osxAutoStartLabel :: String
|
|
|
|
osxAutoStartLabel = "com.branchable.git-annex.assistant"
|
2012-09-26 21:19:45 +00:00
|
|
|
|
2012-09-28 23:08:13 +00:00
|
|
|
fdoAutostart :: FilePath -> DesktopEntry
|
|
|
|
fdoAutostart command = genDesktopEntry
|
|
|
|
"Git Annex Assistant"
|
|
|
|
"Autostart"
|
|
|
|
False
|
|
|
|
(command ++ " assistant --autostart")
|
|
|
|
[]
|