sh: Add new XDG_STATE_HOME env var from spec

The XDG BASE DIRECTORY spec now includes a provision for 'state' stuff,
that does not quite fit into either the permanent nature of
XDG_DATA_HOME, nor into the impermanence and deletable nature of
XDG_CACHE_HOME - i.e. longer running logs or history files. Things you
don't necessarily need backed up at all times, but things that should
also not change every time the tmpfs is flushed, should you run your
.cache directory under one.

More here: https://teddit.net/r/linux/comments/ny34vs/new_xdg_state_home_in_xdg_base_directory_spec/
and here: https://wiki.debian.org/XDGBaseDirectorySpecification#state
This commit is contained in:
Marty Oehme 2022-06-28 10:20:57 +02:00
parent 4f1bc97977
commit e25ce19719
Signed by: Marty
GPG Key ID: B7538B8F50A1C800
1 changed files with 4 additions and 1 deletions

View File

@ -18,12 +18,12 @@
test "$XDG_CACHE_HOME" || export XDG_CACHE_HOME="$HOME/.cache"
test "$XDG_CONFIG_HOME" || export XDG_CONFIG_HOME="$HOME/.config"
test "$XDG_DATA_HOME" || export XDG_DATA_HOME="$HOME/.local/share"
test "$XDG_STATE_HOME" || export XDG_STATE_HOME="$HOME/.local/state"
# Desktop environment XDG variables - mimics `xdg-user-dirs` settings, only lowercased and not localized
test "$XDG_DESKTOP_DIR" || export XDG_DESKTOP_DIR="$HOME/desktop"
test "$XDG_DOCUMENTS_DIR" || export XDG_DOCUMENTS_DIR="$HOME/documents"
test "$XDG_DOWNLOAD_DIR" || export XDG_DOWNLOAD_DIR="$HOME/downloads"
test "$XDG_PROJECTS_DIR" || export XDG_PROJECTS_DIR="$HOME/projects"
export XDG_MUSIC_DIR="$HOME/media/audio/music"
export XDG_PICTURES_DIR="$HOME/pictures"
@ -32,6 +32,7 @@ export XDG_VIDEOS_DIR="$HOME/videos"
## Non-Standard additions
# non-standard, is added to path to enable execution of any files herein
test "$XDG_BIN_HOME" || export XDG_BIN_HOME="$HOME/.local/bin"
test "$XDG_PROJECTS_DIR" || export XDG_PROJECTS_DIR="$HOME/projects"
xdg_isThere() {
if [ -e "$1" ] || [ -h "$1" ]; then
@ -67,3 +68,5 @@ unset -f xdg_isThere xdg_makeForUser
export NVM_DIR="$XDG_DATA_HOME/nvm"
export TMUX_PLUGIN_MANAGER_PATH="$XDG_DATA_HOME/tmux"
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
export ANDROID_HOME="$XDG_DATA_HOME/android"
export ATOM_HOME="$XDG_DATA_HOME/atom"