]>
Commit | Line | Data |
---|---|---|
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 | |
8 | [[ XDG_CACHE_HOME = $_sev_tmp/.xdg.cache ]] && unset XDG_CACHE_DIR | |
9 | [[ XDG_RUNTIME_DIR = $TMPDIR/.xdg.runtime ]] && unset XDG_RUNTIME_DIR | |
10 | ## clean up any remaining sockets from gpg forwarding | |
11 | [[ -v _GNUPG_SOCK_DEST_BASE ]] && rm -f $_GNUPG_SOCK_DEST_BASE*(=N) | |
12 | ||
13 | ## manually reset terminal for interactive logout | |
14 | if [[ -o interactive ]] { | |
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 | |
18 | echo -en '\e[3J' | |
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=1 | |
24 | if [[ -v terminfo ]] { | |
25 | for x (rs1 rs2 rs3) { | |
26 | [[ -v terminfo[$x] ]] || continue | |
27 | echoti $x | |
28 | y=0 | |
29 | } | |
30 | } | |
31 | if { (( y )) && -v termcap ]] } { | |
32 | for x (rs r1 r2 r3) { | |
33 | [[ -v termcap[$x] ]] || continue | |
34 | echotc $x | |
35 | y=0 | |
36 | } | |
37 | } | |
38 | if (( y )) { | |
39 | # fallback, send ECMA-48 clear | |
40 | echo -en '\e[2J' | |
41 | } | |
42 | echo logout | |
43 | } | |
44 | ||
45 | ### load site-specific | |
46 | load-site-dotfile zlogout |