diff options
author | Adrian C. (anrxc) <anrxc@sysphere.org> | 2010-02-15 03:43:45 +0100 |
---|---|---|
committer | Adrian C. (anrxc) <anrxc@sysphere.org> | 2010-02-15 03:44:48 +0100 |
commit | 261c0ba1097f17635a9ceeea371f960ce7c98062 (patch) | |
tree | 33ebcb88f9733f2a7cdc4ac06c1ef6096232b27c | |
parent | fbd0bff3e8e7e3ec28a01773a6172973b3720386 (diff) | |
download | dotfiles-261c0ba1097f17635a9ceeea371f960ce7c98062.tar.xz |
gnupg: reuse the running agent on X11 startup
-rw-r--r-- | gnupg/gpg-agent.conf | 2 | ||||
-rwxr-xr-x | xinitrc | 7 | ||||
-rw-r--r-- | zshrc | 5 |
3 files changed, 9 insertions, 5 deletions
diff --git a/gnupg/gpg-agent.conf b/gnupg/gpg-agent.conf index 5a1f457..a6c6605 100644 --- a/gnupg/gpg-agent.conf +++ b/gnupg/gpg-agent.conf @@ -2,6 +2,8 @@ # Do not grab the keyboard #no-grab +# Write the environment file +write-env-file /home/anrxc/.gnupg/gpg-agent-info # Cache settings max-cache-ttl 7200 default-cache-ttl 7200 @@ -100,7 +100,12 @@ fi # {{{ Autostart settings # # Start the GnuPG agent and enable the OpenSSH agent emulation -eval "$(/usr/bin/killall gpg-agent; /usr/bin/gpg-agent --enable-ssh-support --daemon)" +if ( /bin/pidof gpg-agent >/dev/null ); then + eval "$(cat $HOME/.gnupg/gpg-agent-info)" + eval "$(cut -d= -f 1 < $HOME/.gnupg/gpg-agent-info | xargs echo export)" +else + eval "$(gpg-agent --enable-ssh-support --daemon)" +fi # Play a startup sound #/usr/bin/ogg123 -q $HOME/.fvwm/sounds/Startup.ogg & @@ -160,9 +160,7 @@ function snap () { [ $3 ] && format=$3 || format=png stamp=`date +%d%m%y-%H%M` echo -n "Snapshot in " - for (( i = $tmout; i >= 1; i-- )) do - echo -n "$i.. "; sleep 1 - done + for (( i = $tmout; i >= 1; i-- )) do; echo -n "$i.. "; sleep 1; done import -window root -quality 100 ~/$1-$stamp.$format convert -resize "15%" ~/$1-$stamp.$format ~/$1-$stamp.th.$format echo "saved as: ~/$1-$stamp.$format" @@ -289,7 +287,6 @@ function setprompt () { PR_TITLEBAR=$'%{\e]0;%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}' ;; screen*) - SSH_AUTH_SOCK=`find /tmp/gpg-* -name S.gpg-agent.ssh` PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}' ;; esac |