8

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

Tom Hale
  • 3,728
lofidevops
  • 21,912

2 Answers2

5

I don't see a way to force such behaviour globally, since default config paths are usually hardcoded into the programs.

If you are looking for an easy way to backup all your configs, you could create symlinks on a per-app basis from ~/.app to ~/.config/app. While this unfortunately won't unclutter your home, all config files will be saved in ~/.config for easier backups.

drc
  • 2,890
  • 15
  • 16
5

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.

Pablo Bianchi
  • 17,371
Tom Hale
  • 3,728