]>
git.rmz.io Git - dotfiles.git/blob - zsh/lib/gpg.zsh
2 # Provides for an easier use of GPG by setting up gpg-agent.
5 # Sorin Ionescu <sorin.ionescu@gmail.com>
8 # Return if requirements are not found.
9 if (( ! $
+commands
[gpg
-agent] )); then
13 # Set the default paths to gpg-agent files.
14 _gpg_agent_conf
="$XDG_CONFIG_HOME/gnupg/gpg-agent.conf"
15 _gpg_agent_env
="$XDG_CACHE_HOME/gpg-agent-info"
17 # Start gpg-agent if not started.
18 if ! ps
-U "$USER" -o ucomm
| grep -q gpg
-agent; then
19 eval "$(gpg-agent --daemon --write-env-file "$_gpg_agent_env")"
21 # Export environment variables.
22 source "$_gpg_agent_env" 2> /dev
/null
25 # Inform gpg-agent of the current TTY for user prompts.
26 export GPG_TTY
="$(tty)"
29 unset _gpg_agent_
{conf
,env
}
31 # Disable GUI prompts inside SSH.
32 if [[ -n "$SSH_CONNECTION" ]]; then
33 export PINENTRY_USER_DATA
='USE_CURSES=1'