zsh/zshenv
Danielle McLean f06071e7c7
Drop fragile XDG_RUNTIME_DIR support
An XDG runtime directory cannot be provided reliably by the shell,
because it's supposed to have the same lifetime as the user's login
session, and the shell doesn't have a reliable way to keep track of that
lifetime. There are probably nonportable ways to get a conforming
directory, such as making a request to PAM, but PAM is supposed to set
XDG_RUNTIME_DIR itself anyway and also doesn't exist on Macs, which I
use most of the time.

My configuration isn't actually using XDG_RUNTIME_DIR anyway, so I don't
want to provide the misleading impression that a runtime directory with
proper behaviour conforming to the specification is definitely
available.
2021-09-22 10:27:09 +10:00

11 lines
387 B
Bash

# 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}
: ${XDG_STATE_HOME:=~/.local/state}
export XDG_CONFIG_HOME XDG_CACHE_HOME XDG_DATA_HOME XDG_STATE_HOME
# The real zsh config lives in XDG_CONFIG_HOME! ;)
: ${ZDOTDIR:=$XDG_CONFIG_HOME/zsh}
source $ZDOTDIR/zshenv