Thunar & GPG: context menu
Posted: Thu Apr 05, 2012 11:34 pm
I wanted GPG-integration in my Thunar context menu, but somehow I thought that KGPG was a bit overkill in an XFCE environment 
Using Thunar's built-in "custom actions" editor, I've written a small script and then added custom actions for Thunar.
1) The bash-script
This small wrapper script is necessary, because the filename manipulation (e.g. remove '.gpg' file suffix when decrypting) was not possible by the shell thunar's custom actions are executed in.
Not beautiful, but effective 
2) Decrypt:
Add the following custom action in Thunar:
For encryption, I want to figure out a nice way of selecting the "recipient" from the GUI...

Using Thunar's built-in "custom actions" editor, I've written a small script and then added custom actions for Thunar.
1) The bash-script
This small wrapper script is necessary, because the filename manipulation (e.g. remove '.gpg' file suffix when decrypting) was not possible by the shell thunar's custom actions are executed in.
Code: Select all
#!/bin/bash
FILE_IN="$2"
DIR="$3"
case "$1" in
encrypt)
echo "not implemented, yet."
;;
decrypt)
FILE_OUT="$DIR/$(basename $FILE_IN .gpg)"
echo "Decrypting '$FILE_IN' to '$FILE_OUT'..."
cmd="gpg --output '$FILE_OUT' --decrypt '$FILE_IN'"
eval $cmd
;;
*)
echo ""
echo "SYNTAX: $0 (encrypt|decrypt) <filename> <dirname>"
echo ""
echo "<filename>: Use %n"
echo "<dirname>: Use %d"
echo ""
sleep 5
;;
esac

2) Decrypt:
Add the following custom action in Thunar:
Code: Select all
xterm -iconic -e /usr/bin/thunar-gpg decrypt %n %d