summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Assistant/Install.hs31
-rw-r--r--debian/changelog2
-rw-r--r--doc/assistant/downloadnotification.pngbin0 -> 4550 bytes
-rw-r--r--doc/assistant/nautilusmenu.pngbin0 -> 59867 bytes
-rw-r--r--doc/related_software.mdwn1
-rw-r--r--doc/tips/file_manager_integration.mdwn31
6 files changed, 63 insertions, 2 deletions
diff --git a/Assistant/Install.hs b/Assistant/Install.hs
index d29cefb8c..ff3002221 100644
--- a/Assistant/Install.hs
+++ b/Assistant/Install.hs
@@ -35,11 +35,14 @@ standaloneAppBase = getEnv "GIT_ANNEX_APP_BASE"
-
- Note that this is done every time it's started, so if the user moves
- it around, the paths this sets up won't break.
+ -
+ - Nautilus hook script installation is done even for packaged apps,
+ - since it has to go into the user's home directory.
-}
ensureInstalled :: IO ()
ensureInstalled = go =<< standaloneAppBase
where
- go Nothing = noop
+ go Nothing = installNautilus "git-annex"
go (Just base) = do
let program = base </> "git-annex"
programfile <- programFile
@@ -78,6 +81,32 @@ ensureInstalled = go =<< standaloneAppBase
viaTmp writeFile shim content
modifyFileMode shim $ addModes [ownerExecuteMode]
+ installNautilus program
+
+installNautilus :: FilePath -> IO ()
+#ifdef linux_HOST_OS
+installNautilus program = do
+ scriptdir <- (\d -> d </> "nautilus" </> "scripts") <$> userDataDir
+ genscript scriptdir "get"
+ genscript scriptdir "drop"
+ where
+ genscript scriptdir action =
+ installscript (scriptdir </> scriptname action) $ unlines
+ [ "#!/bin/sh"
+ , autoaddedcomment
+ , program ++ " " ++ action ++ " --notify-start --notify-finish \"$@\""
+ ]
+ scriptname action = "git-annex " ++ action
+ installscript f c = whenM (safetoinstallscript f) $ do
+ writeFile f c
+ modifyFileMode f $ addModes [ownerExecuteMode]
+ safetoinstallscript f = catchDefaultIO True $
+ elem autoaddedcomment . lines <$> readFileStrict f
+ autoaddedcomment = "# Automatically added by git-annex, do not edit. (To disable, chmod 600 this file.)"
+#else
+installNautilus _ = noop
+#endif
+
{- Returns a cleaned up environment that lacks settings used to make the
- standalone builds use their bundled libraries and programs.
- Useful when calling programs not included in the standalone builds.
diff --git a/debian/changelog b/debian/changelog
index 7addf4ae7..20b559324 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,8 @@ git-annex (5.20140321) UNRELEASED; urgency=medium
(using the dbus Desktop Notifications Specification)
* --notify-start switch will show desktop notifications when each
file upload/download starts.
+ * webapp: Automatically install Nautilus integration scripts
+ to get and drop files.
-- Joey Hess <joeyh@debian.org> Fri, 21 Mar 2014 14:08:41 -0400
diff --git a/doc/assistant/downloadnotification.png b/doc/assistant/downloadnotification.png
new file mode 100644
index 000000000..5cb3961d9
--- /dev/null
+++ b/doc/assistant/downloadnotification.png
Binary files differ
diff --git a/doc/assistant/nautilusmenu.png b/doc/assistant/nautilusmenu.png
new file mode 100644
index 000000000..d7926e34f
--- /dev/null
+++ b/doc/assistant/nautilusmenu.png
Binary files differ
diff --git a/doc/related_software.mdwn b/doc/related_software.mdwn
index 1b5579628..66abad8df 100644
--- a/doc/related_software.mdwn
+++ b/doc/related_software.mdwn
@@ -11,4 +11,3 @@ designed to interoperate with it.
utility, with a `-A` switch that enables git-annex support.
* Emacs Org mode can auto-commit attached files to git-annex.
* [git annex darktable integration](https://github.com/xxv/darktable-git-annex)
-* [Nautilus file manager ingegration](https://gist.github.com/ion1/9660286)
diff --git a/doc/tips/file_manager_integration.mdwn b/doc/tips/file_manager_integration.mdwn
new file mode 100644
index 000000000..18210b8ee
--- /dev/null
+++ b/doc/tips/file_manager_integration.mdwn
@@ -0,0 +1,31 @@
+Integrating git-annex and your file manager provides an easy way to select
+annexed files to get or drop.
+
+## nautilus
+
+Recent git-annex comes with built-in nautilus integration. Just pick the
+action from the menu.
+
+[[!img assistant/nautilusmenu.png]]
+
+[[!img assistant/downloadnotification.png]]
+
+This is set up by making simple scripts in
+`~/.local/share/nautilus/scripts`, with names like "git-annex get"
+
+## your file manager here
+
+Edit this page and add instructions!
+
+## general
+
+If your file manager can run a command on a file, it should be easy to
+integrate git-annex with it. A simple script will suffice:
+
+ #!/bun/sh
+ git-annex get --notify-start --notify-finish "$@"
+
+The --notify-start and --notify-stop options make git-annex display a
+desktop notification. This is useful to give the user an indication that
+their action took effect. Desktop notifications are currently only
+implenented for Linux.