linux standalone auto-install icons
This commit is contained in:
parent
9dac79a018
commit
00e6663128
5 changed files with 36 additions and 25 deletions
|
@ -49,8 +49,9 @@ ensureInstalled = go =<< standaloneAppBase
|
||||||
#ifdef darwin_HOST_OS
|
#ifdef darwin_HOST_OS
|
||||||
autostartfile <- userAutoStart osxAutoStartLabel
|
autostartfile <- userAutoStart osxAutoStartLabel
|
||||||
#else
|
#else
|
||||||
installMenu program
|
menufile <- desktopMenuFilePath "git-annex" <$> userDataDir
|
||||||
=<< desktopMenuFilePath "git-annex" <$> userDataDir
|
icondir <- iconDir <$> userDataDir
|
||||||
|
installMenu program menufile base icondir
|
||||||
autostartfile <- autoStartPath "git-annex" <$> userConfigDir
|
autostartfile <- autoStartPath "git-annex" <$> userConfigDir
|
||||||
#endif
|
#endif
|
||||||
installAutoStart program autostartfile
|
installAutoStart program autostartfile
|
||||||
|
|
|
@ -9,14 +9,20 @@
|
||||||
|
|
||||||
module Assistant.Install.Menu where
|
module Assistant.Install.Menu where
|
||||||
|
|
||||||
|
import Common
|
||||||
|
|
||||||
import Utility.FreeDesktop
|
import Utility.FreeDesktop
|
||||||
|
|
||||||
installMenu :: FilePath -> FilePath -> IO ()
|
installMenu :: FilePath -> FilePath -> FilePath -> FilePath -> IO ()
|
||||||
installMenu command file =
|
installMenu command menufile iconsrcdir icondir = do
|
||||||
#ifdef darwin_HOST_OS
|
#ifdef darwin_HOST_OS
|
||||||
return ()
|
return ()
|
||||||
#else
|
#else
|
||||||
writeDesktopMenuFile (fdoDesktopMenu command) file
|
writeDesktopMenuFile (fdoDesktopMenu command) menufile
|
||||||
|
installIcon (iconsrcdir </> "logo.svg") $
|
||||||
|
iconFilePath (iconBaseName ++ ".svg") "scalable" icondir
|
||||||
|
installIcon (iconsrcdir </> "favicon.png") $
|
||||||
|
iconFilePath (iconBaseName ++ ".png") "16x16" icondir
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{- The command can be either just "git-annex", or the full path to use
|
{- The command can be either just "git-annex", or the full path to use
|
||||||
|
@ -27,5 +33,15 @@ fdoDesktopMenu command = genDesktopEntry
|
||||||
"Track and sync the files in your Git Annex"
|
"Track and sync the files in your Git Annex"
|
||||||
False
|
False
|
||||||
(command ++ " webapp")
|
(command ++ " webapp")
|
||||||
(Just "git-annex") -- icon base name
|
(Just iconBaseName)
|
||||||
["Network", "FileTransfer"]
|
["Network", "FileTransfer"]
|
||||||
|
|
||||||
|
installIcon :: FilePath -> FilePath -> IO ()
|
||||||
|
installIcon src dest = do
|
||||||
|
createDirectoryIfMissing True (parentDir dest)
|
||||||
|
withBinaryFile src ReadMode $ \hin ->
|
||||||
|
withBinaryFile dest WriteMode $ \hout ->
|
||||||
|
hGetContents hin >>= hPutStr hout
|
||||||
|
|
||||||
|
iconBaseName :: String
|
||||||
|
iconBaseName = "git-annex"
|
||||||
|
|
|
@ -28,7 +28,6 @@ import System.Posix.Files
|
||||||
#endif
|
#endif
|
||||||
import System.FilePath
|
import System.FilePath
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import System.IO
|
|
||||||
|
|
||||||
systemwideInstall :: IO Bool
|
systemwideInstall :: IO Bool
|
||||||
#ifndef mingw32_HOST_OS
|
#ifndef mingw32_HOST_OS
|
||||||
|
@ -52,25 +51,14 @@ writeFDODesktop command = do
|
||||||
systemwide <- systemwideInstall
|
systemwide <- systemwideInstall
|
||||||
|
|
||||||
datadir <- if systemwide then return systemDataDir else userDataDir
|
datadir <- if systemwide then return systemDataDir else userDataDir
|
||||||
installMenu command
|
menufile <- inDestDir (desktopMenuFilePath "git-annex" datadir)
|
||||||
=<< inDestDir (desktopMenuFilePath "git-annex" datadir)
|
icondir <- inDestDir (iconDir datadir)
|
||||||
|
installMenu command menufile "doc" icondir
|
||||||
installIcon "doc/logo.svg"
|
|
||||||
=<< inDestDir (iconFilePath "git-annex.svg" "scalable" datadir)
|
|
||||||
installIcon "doc/favicon.png"
|
|
||||||
=<< inDestDir (iconFilePath "git-annex.png" "16x16" datadir)
|
|
||||||
|
|
||||||
configdir <- if systemwide then return systemConfigDir else userConfigDir
|
configdir <- if systemwide then return systemConfigDir else userConfigDir
|
||||||
installAutoStart command
|
installAutoStart command
|
||||||
=<< inDestDir (autoStartPath "git-annex" configdir)
|
=<< inDestDir (autoStartPath "git-annex" configdir)
|
||||||
|
|
||||||
installIcon :: FilePath -> FilePath -> IO ()
|
|
||||||
installIcon src dest = do
|
|
||||||
createDirectoryIfMissing True (parentDir dest)
|
|
||||||
withBinaryFile src ReadMode $ \hin ->
|
|
||||||
withBinaryFile dest WriteMode $ \hout ->
|
|
||||||
hGetContents hin >>= hPutStr hout
|
|
||||||
|
|
||||||
writeOSXDesktop :: FilePath -> IO ()
|
writeOSXDesktop :: FilePath -> IO ()
|
||||||
writeOSXDesktop command = do
|
writeOSXDesktop command = do
|
||||||
installAutoStart command =<< inDestDir =<< ifM systemwideInstall
|
installAutoStart command =<< inDestDir =<< ifM systemwideInstall
|
||||||
|
|
1
Makefile
1
Makefile
|
@ -107,6 +107,7 @@ linuxstandalone: Build/Standalone
|
||||||
strip "$(LINUXSTANDALONE_DEST)/bin/git-annex"
|
strip "$(LINUXSTANDALONE_DEST)/bin/git-annex"
|
||||||
ln -sf git-annex "$(LINUXSTANDALONE_DEST)/bin/git-annex-shell"
|
ln -sf git-annex "$(LINUXSTANDALONE_DEST)/bin/git-annex-shell"
|
||||||
zcat standalone/licences.gz > $(LINUXSTANDALONE_DEST)/LICENSE
|
zcat standalone/licences.gz > $(LINUXSTANDALONE_DEST)/LICENSE
|
||||||
|
cp doc/favicon.png doc/logo.svg $(LINUXSTANDALONE_DEST)
|
||||||
|
|
||||||
./Build/Standalone "$(LINUXSTANDALONE_DEST)"
|
./Build/Standalone "$(LINUXSTANDALONE_DEST)"
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ module Utility.FreeDesktop (
|
||||||
writeDesktopMenuFile,
|
writeDesktopMenuFile,
|
||||||
desktopMenuFilePath,
|
desktopMenuFilePath,
|
||||||
autoStartPath,
|
autoStartPath,
|
||||||
|
iconDir,
|
||||||
iconFilePath,
|
iconFilePath,
|
||||||
systemDataDir,
|
systemDataDir,
|
||||||
systemConfigDir,
|
systemConfigDir,
|
||||||
|
@ -93,13 +94,17 @@ autoStartPath :: String -> FilePath -> FilePath
|
||||||
autoStartPath basename configdir =
|
autoStartPath basename configdir =
|
||||||
configdir </> "autostart" </> desktopfile basename
|
configdir </> "autostart" </> desktopfile basename
|
||||||
|
|
||||||
{- Path to use for an icon file, in either the systemDataDir
|
{- Base directory to install an icon file, in either the systemDataDir
|
||||||
- or the userDatadir.
|
- or the userDatadir. -}
|
||||||
|
iconDir :: FilePath -> FilePath
|
||||||
|
iconDir datadir = datadir </> "icons" </> "hicolor"
|
||||||
|
|
||||||
|
{- Filename of an icon, given the iconDir to use.
|
||||||
-
|
-
|
||||||
- The resolution is something like "48x48" or "scalable". -}
|
- The resolution is something like "48x48" or "scalable". -}
|
||||||
iconFilePath :: FilePath -> String -> FilePath -> FilePath
|
iconFilePath :: FilePath -> String -> FilePath -> FilePath
|
||||||
iconFilePath file resolution datadir = datadir </> "icons" </>
|
iconFilePath file resolution icondir =
|
||||||
"hicolor" </> resolution </> "apps" </> file
|
icondir </> resolution </> "apps" </> file
|
||||||
|
|
||||||
desktopfile :: FilePath -> FilePath
|
desktopfile :: FilePath -> FilePath
|
||||||
desktopfile f = f ++ ".desktop"
|
desktopfile f = f ++ ".desktop"
|
||||||
|
|
Loading…
Reference in a new issue