summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--dot_zshenv11
-rwxr-xr-xrun_macos_create_xdg_runtime_dir.sh6
2 files changed, 17 insertions, 0 deletions
diff --git a/dot_zshenv b/dot_zshenv
index 702bfd3..dff58be 100644
--- a/dot_zshenv
+++ b/dot_zshenv
@@ -25,6 +25,17 @@ setopt pushd_to_home          # No arguments is the same as pushd $HOME - mimic
 setopt pushd_ignore_dups      # Ignore pushd dupes
 export DIRSTACKSIZE=16
 
+# Set XDG_* path vars for better compat
+# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
+# TODO: XDG_RUNTIME_DIR cleanup on logout
+[[ -v XDG_CONFIG_HONE ]] || export XDG_CONFIG_HOME=${HOME}/.config
+[[ -v XDG_CACHE_HOME ]] || export XDG_CACHE_HOME=${HOME}/.cache
+[[ -v XDG_DATA_HOME ]] || export XDG_DATA_HOME=${HOME}/.local/share
+[[ -v XDG_STATE_HOME ]] || export XDG_STATE_HOME=${HOME}/.local/state
+[[ -v XDG_DATA_DIRS ]] || export XDG_DATA_DIRS=/usr/local/share:/usr/share
+[[ -v XDG_CONFIG_DIRS ]] || export XDG_CONFIG_DIRS=/etc/xdg
+[[ -v XDG_RUNTIME_DIR ]] || export XDG_RUNTIME_DIR=${HOME}/.cache/xdg-runtime-dir
+
 # (Re)set locales, a reminder that we live in a world built upon bad decisions
 export LANG=en_US.UTF-8
 export LC_ALL=en_US.UTF-8
diff --git a/run_macos_create_xdg_runtime_dir.sh b/run_macos_create_xdg_runtime_dir.sh
new file mode 100755
index 0000000..bc1a95a
--- /dev/null
+++ b/run_macos_create_xdg_runtime_dir.sh
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+
+set -e
+
+umask 0077
+mkdir -p "${HOME}/.cache/xdg-runtime-dir"