# properly configured for any child processes.
# * some desktop environments/graphical terminal emulators will start new
# terminal windows with login shells, which runs .zprofile every time and
-# leads to noticably slow startup times.
-# * switching users without wiping the environment will result in paths and
-# variables intended for the old user being used for the new user. while
-# this may be considered an edge-case that should not be supported, there
-# are legitimate reasons to want to do this, and in any case the shell
-# should not choke or cause unexpected problems should it happen anyway.
+# leads to noticably slow startup times if we have not already ran it.
### cleanup
# XXX: only call after relevant vars have been set up, defined early so that
# XXX: perms are not specified for XDG dirs except runtime, but I think 760
# makes the most sense. shouldn't break anything since no one else should
# be poking around in our dir.
-[[ -e ~/.local ]] || mkdir -m760 ~/.local
+[[ -e ${_sev_home:-~}/.local ]] || mkdir -m760 ${_sev_home:-~}/.local
### tmp
# NOTE: specs say that POSIX tmp and XDG runtime directories should exist
# toplevel session (i.e. SHLVL=1). this should placate most applications,
# though it is not expressly spec compliant.
if [[ ! -v _sev_tmp ]] {
- _sev_tmp=~/.local/tmp
+ _sev_tmp=${_sev_home:-~}/.local/tmp
# NOTE: race condition/remove in use files
[[ -h $_sev_tmp ]] && unlink $_sev_tmp 2>/dev/null
t=${TMPDIR:-${TEMP:-${TMP:-/tmp}}}/.home-$LOGNAME
}
}
- # make runtime dir in our session-specific tmpdir
- export XDG_RUNTIME_DIR=$TMPDIR/.xdg.runtime
- # same as in tmpdir creation, ensure dir doesn't exist
- if [[ -h $XDG_RUNTIME_DIR ]] {
- unlink $XDG_RUNTIME_DIR 2>/dev/null
- } elif [[ -e $XDG_RUNTIME_DIR ]] {
- rm -rf $XDG_RUNTIME_DIR 2>/dev/null
+ if [[ -v XDG_RUNTIME_DIR ]] {
+ export XDG_RUNTIME_DIR
+ } else {
+ # make runtime dir in our session-specific tmpdir
+ export XDG_RUNTIME_DIR=$TMPDIR/.xdg.runtime
+ # same as in tmpdir creation, ensure dir doesn't exist
+ if [[ -h $XDG_RUNTIME_DIR ]] {
+ unlink $XDG_RUNTIME_DIR 2>/dev/null
+ } elif [[ -e $XDG_RUNTIME_DIR ]] {
+ rm -rf $XDG_RUNTIME_DIR 2>/dev/null
+ }
+ mkdir -m700 $XDG_RUNTIME_DIR 2>/dev/null
}
- mkdir -m700 $XDG_RUNTIME_DIR 2>/dev/null
# source user dirs after other vars
[[ -e $XDG_CONFIG_HOME/user-dirs.dirs ]] &&
### load site-specific
if [[ -f ${ZDOTDIR:-~}/.zprofile.local ]] { source ${ZDOTDIR:-~}/.zprofile.local }
-
-# vim: et sts=4 sw=4 ts=8 tw=79