4

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

  • 1
    Note that some applications for backwards compatibility will use either, and so particularly if you have an old, repeatedly upgraded install you might be able to just move some old settings to $X_C_H. Unfortunately there is no easy way to know which applications this will work for a priori... – chronitis Dec 9 '13 at 9:20
1

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/index.php/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.

3

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.