aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2018-01-13 11:21:52 +0800
committerAaron LI <aly@aaronly.me>2018-01-13 11:21:52 +0800
commitfb1a24bb8c0d8afde367cfa8b536510c1eb0f132 (patch)
tree26311e779cb0051236945caaec7c277410e773f8
parent4fffe7fdb66a65f6e4b1efe9c457ba663b30acbe (diff)
downloaddotfiles-fb1a24bb8c0d8afde367cfa8b536510c1eb0f132.tar.bz2
zsh: launch gpg-agent only on non-ssh logins
-rw-r--r--_profile5
-rw-r--r--_zlogin10
2 files changed, 8 insertions, 7 deletions
diff --git a/_profile b/_profile
index b219d75..d43f2cc 100644
--- a/_profile
+++ b/_profile
@@ -88,11 +88,6 @@ export VISUAL="${EDITOR}"
export PAGER="less"
export LESS="--ignore-case --raw-control-chars"
-## Start `gpg-agent' if it is not running
-if ! _running gpg-agent; then
- gpgconf --launch gpg-agent
-fi
-
PROFILE_SOURCED=yes
# EOF
diff --git a/_zlogin b/_zlogin
index 8220a9e..65a0364 100644
--- a/_zlogin
+++ b/_zlogin
@@ -11,8 +11,14 @@
# 2016-01-31
#
-## Auto startx if login on tty6
-if (( $EUID != 0 )) && [[ -z $DISPLAY ]] && [[ $TTY = "/dev/tty6" ]]; then
+## Start `gpg-agent' on login (non-SSH connections)
+GPG_AGENT_SOCKET="${XDG_RUNTIME_DIR}/gnupg/S.gpg-agent"
+if [[ -z ${SSH_CONNECTION} ]] && [[ ! -S "${GPG_AGENT_SOCKET}" ]]; then
+ gpgconf --launch gpg-agent
+fi
+
+## Auto start X if login on tty6
+if (( ${EUID} != 0 )) && [[ -z ${DISPLAY} ]] && [[ ${TTY} = "/dev/tty6" ]]; then
if [ -e ~/.xsession-errors ]; then
mv -f ~/.xsession-errors ~/.xsession-errors.old
fi