From 74fac2fd26ce672d02f68ef683463e9a86341aec Mon Sep 17 00:00:00 2001 From: Alen Date: Sat, 23 Sep 2023 22:16:43 +0400 Subject: Add XDH_* env vars to zshenv --- dot_zshenv | 11 +++++++++++ run_macos_create_xdg_runtime_dir.sh | 6 ++++++ 2 files changed, 17 insertions(+) create mode 100755 run_macos_create_xdg_runtime_dir.sh 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" -- cgit 1.4.1-2-gfad0