The XDG specification talks about the XDG_CONFIG_HOME variable, but does not specify where it should be defined. Should we define it in /etc/X11/Xsession, or is it the window manager's config file that needs to define this?
I tried declaring it in /etc/environment as
XDG_CONFIG_HOME="$HOME/.config"
but that didn't work, as it seems that $HOME is not defined when /etc/environment is parsed.
The only documentation I could find online was for Gentoo, where it was declared in /etc/env.d/90xsession
I'm using Ubuntu. What would be the general solution for Debian based distros?
XDG_CONFIG_HOMEwill make little difference anyway, if any. – MestreLion Aug 02 '15 at 09:19XDG_CONFIG_HOMEwithout following the spec, assuming that it's a standard Linux or even Unix feature rather than part of a third-party specification. – Eagle-Eye Dec 03 '16 at 21:54XDG_CONFIG_HOMEetc therefore? – mcnesium Dec 06 '16 at 10:10XDG_CONFIG_HOMEbut does not fallback to$HOME/.config. Think of programs that adoptXDG_CONFIG_HOMEbut want to stay backward-compatible. – Torsten Bronger May 29 '20 at 06:57~/.appnameis just a (poor) convention. If byobu is falling back to~/.appnamewhenXDG_CONFIG_HOMEis not set, then it's terribly misusing the XDG standard and its variables, and should be fixed. – MestreLion Jun 06 '20 at 17:24~/.appnamedir, then use it; otherwise use$XDG_CONFIG_HOME(falling back to$HOME/.config, obviously). It's the sanest solution IMHO. In Bash it's a one-liner:DATADIR=$HOME/.$APPNAME; if ! [[ -d "$DATADIR" ]]; then DATADIR=${XDG_CONFIG_HOME:-$HOME/.config}/$APPNAME; fi– MestreLion Jun 06 '20 at 17:32ifs, misusing the spec, when this could've been so simple. Yeah, if you code it like this, XDG seems awkward and complex. – MestreLion Nov 04 '21 at 05:25