2016-10-05 21:46:17 -04:00
|
|
|
# Initialise each of the XDG vars to their default values if they're unset.
|
|
|
|
: ${XDG_CACHE_HOME:=~/.cache}
|
|
|
|
: ${XDG_CONFIG_HOME:=~/.config}
|
|
|
|
: ${XDG_DATA_HOME:=~/.local/share}
|
2021-09-21 20:21:20 -04:00
|
|
|
: ${XDG_STATE_HOME:=~/.local/state}
|
2016-10-05 21:46:17 -04:00
|
|
|
|
2016-10-22 23:48:29 -04:00
|
|
|
# For XDG_RUNTIME_DIR, pick a temporary directory - the spec actually
|
|
|
|
# *requires* that it's destroyed when the user logs out, so that's handled by a
|
|
|
|
# file in zlogout. The reason for suffixing /xdg-$UID is that TMPDIR does not
|
|
|
|
# necessarily belong to the current user exclusively (although it does under
|
|
|
|
# MacOS and PAM). This is especially true if $TMPDIR isn't set at all and /tmp
|
|
|
|
# is used!
|
|
|
|
[[ -z $XDG_RUNTIME_DIR ]] && XDG_RUNTIME_DIR=${${TMPDIR-/tmp}%/}/xdg-$UID
|
|
|
|
if ! [[ -d $XDG_RUNTIME_DIR ]]; then
|
|
|
|
mkdir -p $XDG_RUNTIME_DIR
|
|
|
|
chmod 0700 $XDG_RUNTIME_DIR
|
|
|
|
fi
|
2021-09-21 20:21:20 -04:00
|
|
|
export XDG_CONFIG_HOME XDG_CACHE_HOME XDG_DATA_HOME XDG_STATE_HOME XDG_RUNTIME_DIR
|
2016-10-05 21:46:17 -04:00
|
|
|
|
|
|
|
# The real zsh config lives in XDG_CONFIG_HOME! ;)
|
2016-10-05 18:21:16 -04:00
|
|
|
: ${ZDOTDIR:=$XDG_CONFIG_HOME/zsh}
|
|
|
|
source $ZDOTDIR/zshenv
|