git-annex/doc/tips/file_manager_integration.mdwn

116 lines
3.8 KiB
Text
Raw Normal View History

Integrating git-annex and your file manager provides an easy way to select
annexed files to get or drop. The file manager can also be used to undo
changes to file managed by git-annex.
2014-03-31 15:11:56 +00:00
[[!toc]]
2014-07-21 19:37:44 +00:00
## GNOME (nautilus)
2014-07-21 19:37:44 +00:00
Recent git-annex comes with built-in integration for Nautilus.
[[!img assistant/nautilusmenu.png]]
[[!img assistant/downloadnotification.png]]
2014-07-21 19:37:44 +00:00
This is set up by git-annex creating simple scripts in
`~/.local/share/nautilus/scripts`, with names like "git-annex get"
2014-07-21 19:37:44 +00:00
## KDE (Dolphin/Konqueror)
Even more recent git-annex comes with built-in integration with Konqueror.
[[!img assistant/konquerormenu.png]]
This is set up by git-annex creating a
`~/.kde/share/kde4/services/ServiceMenus/git-annex.desktop file.
2014-03-24 15:47:48 +00:00
2014-03-31 15:14:07 +00:00
## XFCE (Thunar)
2014-03-31 15:11:56 +00:00
XFCE uses the Thunar file manager, which can also be easily configured to
allow for custom actions. Just go to the "Configure custom actions..." item
in the "Edit" menu, and create a custom action for get, drop, and undo with the
following commands:
2014-03-31 15:11:56 +00:00
2014-04-01 10:04:59 +00:00
git-annex drop --notify-start --notify-finish -- %F
2014-03-31 15:11:56 +00:00
for drop, and for get:
2014-10-22 17:01:53 +00:00
git-annex get --notify-start --notify-finish -- %F
and for undo:
git-annex undo --notify-start --notify-finish -- %F
2014-03-31 15:11:56 +00:00
This gives me the resulting config on disk, in `.config/Thunar/uca.xml`:
<action>
<icon>git-annex</icon>
<name>git-annex get</name>
<unique-id>1396278104182858-3</unique-id>
2014-04-01 10:04:59 +00:00
<command>git-annex get --notify-start --notify-finish -- %F</command>
2014-03-31 15:11:56 +00:00
<description>get the files from a remote git annex repository</description>
<patterns>*</patterns>
<directories/>
<audio-files/>
<image-files/>
<other-files/>
<text-files/>
<video-files/>
</action>
<action>
<icon>git-annex</icon>
<name>git-annex drop</name>
<unique-id>1396278093174843-2</unique-id>
2014-04-01 10:04:59 +00:00
<command>git-annex drop --notify-start --notify-finish -- %F</command>
2014-03-31 15:11:56 +00:00
<description>drop the files from the local repository</description>
<patterns>*</patterns>
<directories/>
<audio-files/>
<image-files/>
<other-files/>
<text-files/>
<video-files/>
</action>
The complete instructions on how to setup actions is [in the XFCE documentation](http://docs.xfce.org/xfce/thunar/custom-actions).
2014-04-23 13:12:07 +00:00
## OS X (Finder)
For OS X, it is possible to get context menus in Finder. Due to how OS X
deals with sym links, one needs to operate on folders if using indirect
mode. Direct mode operation has not been tested.
2014-04-23 13:12:07 +00:00
1. Open Automator and create a new Service.
2. Using the Drop down menus in the top create the sentence "Service receives selected folders in Finder.app" to have it work on folders. For direct mode operation it is probably reasonable to select "files or folders".
3. Add a "Run shell script" element and fill in line with the following script:
#!/usr/bin/bash
source ~/.bash_profile
for f in "$@"
do
cd "$(dirname "$f")" && git-annex get "$f"
done
2014-04-23 13:12:07 +00:00
The purpose of the first line is there to get git-annex on to the path. The
reason for the for loop is in case multiple files or folders are marked
when running the context menu command.
2014-04-23 13:12:07 +00:00
Finally save the the workflow under the name for which it should be listed in the context menu.
## 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:
2014-04-13 16:36:55 +00:00
#!/bin/sh
2014-04-01 10:04:59 +00:00
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
2014-04-13 16:36:55 +00:00
implemented for Linux.