Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

How can I force all applications to use $XDG_CONFIG_HOME instead of ~/.APP?

Writer Matthew Harrington

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

2 Answers

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
# and
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.

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

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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