XDG base directory standard [1] defines environment variables with
important paths in user home directory. For example, XDG_CONFIG_HOME
points to a directory with configuration files.
Many programs respect the XDG base directory specification. For
example, git looks for it dotfile as either $HOME/.gitconfig or
$XDG_CONFIG_HOME/git/config. Therefore, XDG environment variables
should be defined early during startup.
This commit adds 10-xdg.sh which defines XDG base directory
variables. Prefix '10-' ensures that the files will be sourced by
~/.profile before other files in ~/.config/profile.d.
[1] https://specifications.freedesktop.org/basedir-spec
--- /dev/null
+# Copyright (c) 2022 Jakub Czajka <jakub@ekhem.eu.org>
+# License: GPL-3.0 or later.
+#
+# 10-xdg.sh - XDG Base Directory environment variables.
+
+export XDG_CONFIG_DIRS="/etc/xdg:${XDG_CONFIG_DIRS}"
+export XDG_CACHE_HOME="${HOME}/.cache"
+export XDG_CONFIG_HOME="${HOME}/.config"
+export XDG_DATA_DIRS="/usr/local/share/:/usr/share/:${XDG_DATA_DIRS}"
+export XDG_DATA_HOME="${HOME}/.local/share"
+export XDG_DESKTOP_DIR="${HOME}"
+export XDG_LOG_HOME="${HOME}/.local/var/log"
+export XDG_STATE_HOME="${HOME}/.local/state"