Skip to content

Instantly share code, notes, and snippets.

@danielpza
Last active August 27, 2022 04:11
Show Gist options
  • Save danielpza/5a7de69fb944cf7207d919989fc50f4a to your computer and use it in GitHub Desktop.
Save danielpza/5a7de69fb944cf7207d919989fc50f4a to your computer and use it in GitHub Desktop.
#!/usr/bin/env sh
# https://stackoverflow.com/a/28085062/6051261
# https://wiki.archlinux.org/title/XDG_Base_Directory#Support
: "${XDG_CONFIG_HOME:=$HOME/.config}"
: "${XDG_CACHE_HOME:=$HOME/.cache}"
: "${XDG_DATA_HOME:=$HOME/.local/share}"
: "${XDG_STATE_HOME:=$HOME/.local/state}"
export XDG_CONFIG_HOME
export XDG_CACHE_HOME
export XDG_DATA_HOME
export XDG_STATE_HOME
includedir() {
[[ -d $1 ]] && PATH="$1:$PATH"
}
export PYENV_ROOT="$XDG_DATA_HOME/pyenv"
includedir "$PYENV_ROOT/bin"
export VOLTA_HOME="$XDG_DATA_HOME/volta" # volta
includedir "$VOLTA_HOME/bin"
export RUSTUP_HOME="$XDG_DATA_HOME/rustup" # rustup
export CARGO_HOME="$XDG_DATA_HOME/cargo" # rust cargo
export SSB_HOME="$XDG_DATA_HOME/zoom" # zoom
export GOPATH="$XDG_DATA_HOME"/go # go
includedir "$GOPATH/bin"
export WGETRC="$XDG_CONFIG_HOME/wgetrc"
touch "$XDG_CONFIG_HOME/wgetrc"
alias wget=wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"
# npm https://github.com/npm/rfcs/issues/389#issuecomment-871656832
export npm_config_userconfig=$XDG_CONFIG_HOME/npm/config
export npm_config_cache=$XDG_CACHE_HOME/npm
export npm_config_prefix=$XDG_DATA_HOME/npm
includedir $XDG_DATA_HOME/npm/bin
export NODE_REPL_HISTORY="$XDG_DATA_HOME/node_repl_history"
# gtk
export GTK_RC_FILES="$XDG_CONFIG_HOME"/gtk-1.0/gtkrc
export GTK2_RC_FILES="$XDG_CONFIG_HOME"/gtk-2.0/gtkrc
# kde
export KDEHOME="$XDG_CONFIG_HOME"/kde
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment