sh: Fix XDG directory use for an array of apps

This commit is contained in:
Marty Oehme 2022-06-28 11:10:34 +02:00
parent 4bff036d1d
commit 03ec445076
Signed by: Marty
GPG key ID: B7538B8F50A1C800
3 changed files with 30 additions and 8 deletions

View file

@ -6,9 +6,6 @@
# shellcheck source=xdg
[ -f ~/.config/sh/xdg ] && . ~/.config/sh/xdg
# anything on BIN_HOME should be executable form anywhere
export PATH="$PATH:$XDG_BIN_HOME"
###############################
## BEGIN GLOBAL ENV VARS ##
###############################

View file

@ -31,8 +31,10 @@ 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"
test "$XDG_BIN_HOME" || export XDG_BIN_HOME="$HOME/.local/bin"
# anything on BIN_HOME should be executable form anywhere
export PATH="$PATH:$XDG_BIN_HOME"
xdg_isThere() {
if [ -e "$1" ] || [ -h "$1" ]; then
@ -65,8 +67,31 @@ xdg_isThere "$XDG_PROJECTS_DIR" || xdg_makeForUser "$XDG_PROJECTS_DIR"
unset -f xdg_isThere xdg_makeForUser
## Applications that can be set through environment variables
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"
export CARGO_HOME="$XDG_DATA_HOME/cargo"
export DOCKER_CONFIG="$XDG_CONFIG_HOME/docker"
export GEM_HOME="$XDG_DATA_HOME/gem"
export GEM_SPEC_CACHE="$XDG_CACHE_HOME/gem"
export GNUPGHOME="$XDG_DATA_HOME/gnupg"
export GRADLE_USER_HOME="$XDG_DATA_HOME/gradle"
export GRIPHOME="$XDG_CONFIG_HOME/grip"
export IMAPFILTER_HOME="$XDG_CONFIG_HOME/imapfilter"
export IPYTHONDIR="$XDG_CONFIG_HOME/ipython"
export KDEHOME="$XDG_CONFIG_HOME/kde"
export KODI_DATA="$XDG_DATA_HOME/kodi"
export LESSHISTFILE="XDG_STATE_HOME/lesshst"
export MPLAYER_HOME="$XDG_CONFIG_HOME/mplayer"
export NODE_REPL_HISTORY="$XDG_STATE_HOME/node_repl_history"
export NVM_DIR="$XDG_DATA_HOME/nvm"
export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/pythonrc"
export SQLITE_HISTORY="$XDG_STATE_HOME/sqlite_history"
export TEXMFVAR="$XDG_CACHE_HOME/texlive/texmf-var"
export TMUX_PLUGIN_MANAGER_PATH="$XDG_DATA_HOME/tmux"
export VAGRANT_HOME="$XDG_DATA_HOME/vagrant"
export WINEPREFIX="$XDG_DATA_HOME/wine"
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
export _JAVA_OPTIONS=-Djava.util.prefs.userRoot="$XDG_CONFIG_HOME"/java
alias yarn='yarn --use-yarnrc "$XDG_CONFIG_HOME/yarn/config"'
alias wget='wget --hsts-file="$XDG_STATE_HOME/wget-hsts"'

View file

@ -3,4 +3,4 @@
# make zsh source the correct directory
export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-"$HOME/.config"}
ZDOTDIR="$XDG_CONFIG_HOME/zsh"
ZDOTDIR="${XDG_CONFIG_HOME:-"$HOME/.config"}/zsh"