zsh: Add zlogout to kill ssh-agent

On system where my dotfiles are only partially installed (e.g. only
the shell) for the environment variables defined in the zprofile to take
affect, every terminal instance needs to execute zsh a login-shell.
This lead to numerous instances of the ssh-agent that were not killed
when exiting the shell. As I still need the correct env-vars like
SSH_AGENT_PID in every shell I cannot just pgrep and execute the agent
respectively.

This adds a zlogout that kills the agent spawned in the current shell.
It also stops `exec`ing `startx` as then the zlogout is not read.
This commit is contained in:
2021-04-12 17:13:37 +02:00
parent fd2c3f611b
commit 1b17c35f4b
2 changed files with 6 additions and 1 deletions

1
.config/zsh/.zlogout Normal file
View File

@@ -0,0 +1 @@
[[ -z $SSH_AGENT_PID ]] || kill "$SSH_AGENT_PID"