# clear SSH agent shortly after detaching, unless reattached in the meantime set-hook -g client-detached 'run-shell "~/config/scripts/tmux-clear-keys.sh 180 &"' set-hook -g session-closed 'run-shell "~/config/scripts/tmux-clear-keys.sh 60 &"' set-hook -g client-attached 'run-shell "pkill -f tmux-clear-keys.sh || true"' # ensure the SSH_AUTH_SOCK is updated when re-attaching set -g update-environment "SSH_AUTH_SOCK"