2012-09-28 23:08:13 +00:00
|
|
|
{- Assistant autostart file installation
|
2012-09-26 21:19:45 +00:00
|
|
|
-
|
2015-01-21 16:50:09 +00:00
|
|
|
- Copyright 2012 Joey Hess <id@joeyh.name>
|
2012-09-26 21:19:45 +00:00
|
|
|
-
|
|
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
|
|
-}
|
|
|
|
|
2012-09-28 23:08:13 +00:00
|
|
|
{-# LANGUAGE CPP #-}
|
2015-05-10 20:38:49 +00:00
|
|
|
{-# OPTIONS_GHC -fno-warn-tabs #-}
|
2012-09-28 23:08:13 +00:00
|
|
|
|
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
|
2015-01-09 18:36:02 +00:00
|
|
|
import Utility.Path
|
2012-09-26 21:19:45 +00:00
|
|
|
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
|
2015-01-09 17:11:56 +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")
|
2013-07-09 23:56:30 +00:00
|
|
|
Nothing
|
2012-09-28 23:08:13 +00:00
|
|
|
[]
|