add xdg env check
This commit is contained in:
parent
ac5ce1fbe6
commit
6a15c81069
|
@ -23,26 +23,28 @@ if [[ -d "$HOME/.local/bin" ]] ; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if XDG environment variables are set or set them to default
|
# Check if XDG environment variables are set or set them to default
|
||||||
if [[ -z "$XDG_DATA_HOME" ]]; then
|
if command -v xdg-user-dir 1> /dev/null; then
|
||||||
export XDG_DATA_HOME=$HOME/.local/share
|
if [[ -z "$XDG_DATA_HOME" ]]; then
|
||||||
fi
|
export XDG_DATA_HOME=$HOME/.local/share
|
||||||
if [[ -z "$XDG_CONFIG_HOME" ]]; then
|
fi
|
||||||
export XDG_CONFIG_HOME=$HOME/.config
|
if [[ -z "$XDG_CONFIG_HOME" ]]; then
|
||||||
fi
|
export XDG_CONFIG_HOME=$HOME/.config
|
||||||
if [[ -z "$XDG_STATE_HOME" ]]; then
|
fi
|
||||||
export XDG_STATE_HOME=$HOME/.local/state
|
if [[ -z "$XDG_STATE_HOME" ]]; then
|
||||||
fi
|
export XDG_STATE_HOME=$HOME/.local/state
|
||||||
if [[ -z "$XDG_CACHE_HOME" ]]; then
|
fi
|
||||||
export XDG_CACHE_HOME=$HOME/.cache
|
if [[ -z "$XDG_CACHE_HOME" ]]; then
|
||||||
fi
|
export XDG_CACHE_HOME=$HOME/.cache
|
||||||
|
fi
|
||||||
# Check presence of locale Download folder or create a default one
|
|
||||||
if [[ "$(xdg-user-dir DOWNLOAD)" == "$(xdg-user-dir)" ]]; then
|
# Check presence of locale Download folder or create a default one
|
||||||
mkdir -p "$HOME/Downloads"
|
if [[ "$(xdg-user-dir DOWNLOAD)" == "$(xdg-user-dir)" ]]; then
|
||||||
export XDG_DOWNLOAD_DIR="$HOME/Downloads"
|
mkdir -p "$HOME/Downloads"
|
||||||
else
|
export XDG_DOWNLOAD_DIR="$HOME/Downloads"
|
||||||
XDG_DOWNLOAD_DIR="$(xdg-user-dir DOWNLOAD)"
|
else
|
||||||
export XDG_DOWNLOAD_DIR
|
XDG_DOWNLOAD_DIR="$(xdg-user-dir DOWNLOAD)"
|
||||||
|
export XDG_DOWNLOAD_DIR
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ==============================
|
# ==============================
|
||||||
|
|
Loading…
Reference in a new issue