]>
Commit | Line | Data |
---|---|---|
6d54344e | 1 | ### cleanup |
2 | # XXX: since .zlogout isn't guaranteed to have been run in the same shell as | |
3 | # our .zprofile was (since we source it in .zshenv for SHLVL=1 among other | |
4 | # situations) we are not guaranteed to clean up our current session's tmp, | |
5 | # but it should be cleared out on next session launch | |
6 | _sev_zcleanup | |
7 | ## unset vars that use our tmp since above will remove them | |
e69caf64 | 8 | [[ XDG_CACHE_HOME = $_sev_tmp/.xdg.cache ]] && unset XDG_CACHE_DIR |
9 | [[ XDG_RUNTIME_DIR = $TMPDIR/.xdg.runtime ]] && unset XDG_RUNTIME_DIR | |
6d54344e | 10 | ## clean up any remaining sockets from gpg forwarding |
e69caf64 | 11 | [[ -v _GNUPG_SOCK_DEST_BASE ]] && rm -f $_GNUPG_SOCK_DEST_BASE*(=N) |
79d4a356 | 12 | |
b484bab8 | 13 | ## manually reset terminal for interactive logout |
833b2af3 | 14 | if [[ -o interactive ]] { |
b484bab8 | 15 | # send xterm scrollback clear extension just in case: |
16 | # - TERM may not be set correctly | |
17 | # - terminfo/termcap database entry for reset may be buggy | |
294ed44e | 18 | echo -en '\e[3J' |
b484bab8 | 19 | # use terminfo/termcap directly instead of relying on system clear/reset: |
20 | # - often they are just wrappers for ncurses tput or other tools | |
21 | # - they may not even exist on lightweight systems | |
22 | # - provided scripts/binaries may be buggy or broken | |
23 | y=0 | |
24 | for x (rs1 rs2 rs3) { | |
25 | [[ -v terminfo[$x] ]] || continue | |
26 | echoti $x | |
27 | y=1 | |
28 | } | |
29 | if (( y == 0 )) { | |
30 | for x (rs r1 r2 r3) { | |
31 | [[ -v termcap[$x] ]] || continue | |
32 | echotc $x | |
33 | y=1 | |
34 | } | |
35 | } | |
36 | if (( y == 0 )) { | |
37 | # fallback, send ECMA-48 clear | |
294ed44e | 38 | echo -en '\e[2J' |
b484bab8 | 39 | } |
833b2af3 | 40 | echo logout |
833b2af3 | 41 | } |
8eb81f95 | 42 | |
43 | ### load site-specific | |
4ced48ed | 44 | load-site-dotfile zlogout |