X-Git-Url: https://git.sev.monster/~sev/dotfiles.git/blobdiff_plain/03bc64c4e89dadccb97ce8d1e22477ab8b7210dc..79d4a3561fa6b4bc80d75d8f9940139c2437df36:/base/.zlogout diff --git a/base/.zlogout b/base/.zlogout index 249979e..1e50611 100644 --- a/base/.zlogout +++ b/base/.zlogout @@ -1,2 +1,29 @@ -echo logout +# gpg forward cleanup +if [[ $SHLVL == 1 && $GNUPGHOME =~ '.ssh_forward/\d+$' ]] { + x=$GNUPGHOME + # reset GNUPGHOME + [[ -o GLOB_ASSIGN ]]; y=$? + setopt GLOB_ASSIGN + GNUPGHOME=$GNUPGHOME/../..(:a) + [[ $y != 0 ]] && unsetopt GLOB_ASSIGN + # clean dir if it exists + if [[ -d $x ]] { + find $x -mindepth 1 -maxdepth 1 | while read -r y; do + unlink $y + done + rmdir -p $x 2>/dev/null + } + # clean up any remaining sockets from gpg forwarding + rm -f $_GNUPG_SOCK_DEST_BASE*(N=) +} + +# remove xdg runtime +rm -rf $XDG_RUNTIME_DIR 2>/dev/null + +[[ -o interactive ]] && echo logout clear + +### load site-specific +if [[ -f ~/.zlogout.local ]] { source ~/.zlogout.local } + +# vim: et sts=4 sw=4 ts=8 tw=79