34 lines
1.4 KiB
Text
34 lines
1.4 KiB
Text
|
#!/usr/bin/env sh
|
||
|
# XDG Base Directory Specification
|
||
|
#
|
||
|
# Sets up necessary environment variables for XDG convention,
|
||
|
# and those that applications obey for their environments.
|
||
|
#
|
||
|
# Thank you remeberYou for the idea
|
||
|
# see: https://github.com/rememberYou/dotfiles/blob/master/sh/.config/sh/xdg
|
||
|
#
|
||
|
# Additionally, home directories are set using the XDG specification,
|
||
|
# if the xdg-user-dirs module is enabled.
|
||
|
#
|
||
|
# Shellcheck will complain about setting permissions for the directories
|
||
|
# unless it is ignored https://github.com/koalaman/shellcheck/wiki/SC2174
|
||
|
# shellcheck disable=SC2174
|
||
|
|
||
|
# http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
||
|
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"
|
||
|
|
||
|
## 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"
|
||
|
|
||
|
## ensure directories exist
|
||
|
test -d "$XDG_BIN_HOME" || mkdir -p -m 0700 "$XDG_BIN_HOME"
|
||
|
test -d "$XDG_CACHE_HOME" || mkdir -p -m 0700 "$XDG_CACHE_HOME"
|
||
|
test -d "$XDG_CONFIG_HOME" || mkdir -p -m 0700 "$XDG_CONFIG_HOME"
|
||
|
test -d "$XDG_DATA_HOME" || mkdir -p -m 0700 "$XDG_DATA_HOME"
|
||
|
|
||
|
## Applications that can be set through environment variables
|
||
|
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
|