]> git.sev.monster Git - dotfiles.git/blobdiff - base/.zlogout
switch to sway/wayland, update zsh/mod, move files
[dotfiles.git] / base / .zlogout
index 1e506117626e1a30a0195859586ac23ca6f2c1d3..6e7b474d5033d2756f4ab46f8f87a5dcfb9e4fb2 100644 (file)
@@ -1,5 +1,11 @@
-# gpg forward cleanup
-if [[ $SHLVL == 1 && $GNUPGHOME =~ '.ssh_forward/\d+$' ]] {
+# NOTE: for the cleanups below, even if our shell is not the one that spawned
+#       the directory, SHLVL == 1 means that it should be safe to clean it up.
+#       since .zlogout isn't guaranteed to have been run in the same shell as
+#       our .zprofile was (since we source it in .zshenv) it has to be done
+#       like this.
+
+### gpg forward cleanup
+if [[ $SHLVL == 1 && $GNUPGHOME =~ '/.ssh_forward/\d+/*$' ]] {
     x=$GNUPGHOME
     # reset GNUPGHOME
     [[ -o GLOB_ASSIGN ]]; y=$?
@@ -17,11 +23,15 @@ if [[ $SHLVL == 1 && $GNUPGHOME =~ '.ssh_forward/\d+$' ]] {
     rm -f $_GNUPG_SOCK_DEST_BASE*(N=)
 }
 
-# remove xdg runtime
-rm -rf $XDG_RUNTIME_DIR 2>/dev/null
+### remove tmp runtime if our shell spawned it
+if [[ $SHLVL == 1 && $TMPDIR =~ '/.session.\d+/*$' ]] {
+    rm -rf $TMPDIR 2>/dev/null
+}
 
-[[ -o interactive ]] && echo logout
-clear
+if [[ -o interactive ]] {
+    echo logout
+    clear
+}
 
 ### load site-specific
 if [[ -f ~/.zlogout.local ]] { source ~/.zlogout.local }
This page took 0.036813 seconds and 4 git commands to generate.