Wednesday, May 1, 2024
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 4771  / 3 Years ago, sat, may 29, 2021, 6:02:08

As far as I understand, the XDG guidelines recommend that applications store their configuration in $XDG_CONFIG_HOME/APP (usually ~/.config/APP) rather than ~/.APP (I'm not sure if there are also Debian/Ubuntu guidelines?). However, I have found a number of configuration files and folders using the older ~/.APP convention.



Is there a way to globally force non-confirming applications to use the XDG folder conventions?



Or do I just have to log a ticket with each project? :D


More From » configuration

 Answers
4

I found some excellent configuration information at XDG Base Directory support.


This gives great hints about setting things like:


export LESSHISTFILE="$XDG_CACHE_HOME"/less/history

so that legacy config / cache / data files can still use the XDG specified directories.


I also needed to add in my ~/.bashrc:


# XDG - set defaults as they may not be set
# See https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
# and https://wiki.archlinux.org/title/XDG_Base_Directory#Support
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CACHE_HOME="$HOME/.cache"

if [ ! -w ${XDG_RUNTIME_DIR:="/run/user/$UID"} ]; then
echo "$XDG_RUNTIME_DIR ($XDG_RUNTIME_DIR) not writable. Unsetting." >&2
unset XDG_RUNTIME_DIR
else
export XDG_RUNTIME_DIR
fi

These are not set by default on Ubuntu 14.04 LTS.


[#28068] Sunday, May 30, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
anoalk

Total Points: 271
Total Questions: 90
Total Answers: 112

Location: Zambia
Member since Wed, Dec 16, 2020
3 Years ago
anoalk questions
Wed, Mar 15, 23, 04:06, 1 Year ago
Fri, Sep 24, 21, 02:59, 3 Years ago
Sat, Mar 5, 22, 02:33, 2 Years ago
Tue, Mar 22, 22, 07:19, 2 Years ago
;