[profile] move ssh_agent initialization in .zshrc

This commit is contained in:
odrling 2020-04-21 03:05:16 +02:00
parent 878b90004c
commit fe16145508
2 changed files with 16 additions and 3 deletions

View file

@ -9,9 +9,6 @@ export FZF_DEFAULT_COMMAND="find . -type f | cut -d'/' -f2-"
# fix java swing applications
export _JAVA_AWT_WM_NONREPARENTING=1
# start ssh-agent
eval $(ssh-agent)
[ -f ~/.profile.local ] && . ~/.profile.local
if [ "$(tty)" = '/dev/tty1' ]; then

16
.zshrc
View file

@ -1,6 +1,21 @@
stty -ixon # Disable ctrl-s and ctrl-q.
# ssh-agent
start_ssh_agent() {
ssh-agent | grep -v \^echo > "$SSH_ENV"
chmod 1600 "$SSH_ENV"
}
SSH_ENV="/tmp/.ssh_env.$USER"
if [ -f "$SSH_ENV" ]; then
. "$SSH_ENV"
ps q $SSH_AGENT_PID > /dev/null || start_ssh_agent
else
start_ssh_agent
fi
. "$SSH_ENV"
# load modules
bgnotify_threshold=0
for i in ~/.zsh/*/*.plugin.zsh; do
@ -67,3 +82,4 @@ alias ffprobe="ffprobe -hide_banner"
[ -f ~/.local_env ] && . ~/.local_env
[ -f ~/.zshrc.local ] && . ~/.zshrc.local
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh