dotfiles

Personal dotfiles
git clone https://git.bracken.jp/dotfiles.git
Log | Files | Refs | LICENSE

commit d58831330feda3155253af5d72e61bf57c8385ca
parent 7db2645f724444ae2378c5bce94e620929a3d834
Author: Chris Bracken <chris@bracken.jp>
Date:   Mon,  9 Oct 2023 12:01:42 -0700

Set all XDG path variables on all OSes

Ensure that all of the following are set on all OSes:
* XDG_CONFIG_HOME
* XDG_CACHE_HOME
* XDG_DATA_HOME
* XDG_STATE_HOME
* XDG_RUNTIME_DIR

These are primarily used on Linux, but it's convenient to set them for
FreeBSD, OpenBSD, and Darwin OSes to make the command-line environment
more consistent across OSes, and to allow them to be usable within my
own dotfiles.

Diffstat:
M.config/zsh/.zshenv | 13++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/.config/zsh/.zshenv b/.config/zsh/.zshenv @@ -6,12 +6,19 @@ # Default read-only permissions for group/other. umask 022 -# If not running under a FreeDesktop session manager, set XDG_CONFIG_HOME. +# If not running under a FreeDesktop session manager, set XDG variables. if [[ -z "$XDG_CONFIG_HOME" ]]; then export XDG_CONFIG_HOME="$HOME/.config" fi - -# If not running under a FreeDesktop session manager, set XDG_RUNTIME_DIR. +if [[ -z "$XDG_CACHE_HOME" ]]; then + export XDG_CACHE_HOME="$HOME/.cache" +fi +if [[ -z "$XDG_DATA_HOME" ]]; then + export XDG_DATA_HOME="$HOME/.local/share" +fi +if [[ -z "$XDG_STATE_HOME" ]]; then + export XDG_STATE_HOME="$HOME/.local/state" +fi if [[ -z "$XDG_RUNTIME_DIR" ]]; then export XDG_RUNTIME_DIR="/tmp/user/$(id -u)" mkdir -p "$XDG_RUNTIME_DIR"