Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to force as many of my dotfiles as possible to honor $XDG_CONFIG_HOME (and friends) instead of crapping all over my home directory. This involves some minor tweaks to some common apps, but nothing too complicated. However, I'm having trouble wrestling all of X's config files into ~/.config/X directory or wherever I want it to go. Specifically, the ornery config files are:


I know that it will be quite difficult to avoid some of those sticking around in my home directory (xinitrc, cough cough) but it seems like all the others should be pretty mobile. In fact, many of them (xlog, xsession-errors) feel like they should be relocatable with an environment variable or two -- if my zshrc were loaded before xinitrc, that is.

Does anyone know an easy way to force the majority of these files to obey XDG and take their rightful place in ~/.config? The cleanliness of my home directory would greatly appreciate any tips.

share|improve this question
What method are you using to start X11 -- xinit/startx or a display manager? – grawity May 5 '12 at 11:37
startx, currently. No plans to switch. – So8res May 5 '12 at 16:07
up vote 4 down vote accepted
  • ~/.Xauthority is not a configuration file and only contains temporary authentication tokens, so it should go to $XDG_RUNTIME_DIR or $XDG_CACHE_HOME instead.

    If you are using xinit or startx to launch X11, you can relocate the Xauthority file by pointing $XAUTHORITY elsewhere in your xinitrc, then adding the -auth newpath argument to Xorg in your xserverrc.

    exec /usr/bin/Xorg "$@" -nolisten tcp -auth "$XDG_RUNTIME_DIR/Xauthority"

    GDM stashes the Xauthority files deep inside /var/run/gdm.

  • ~/.Xdefaults is obsolete and should not be used. Its replacement is ~/.Xresources.

  • ~/.xdvirc is unknown to me.

  • ~/.xinitrc can be relocated by giving the new path to xinit:

    startx ~/.config/X11/xinitrc
  • ~/.xlog is unknown to me.

  • ~/.Xresources is only read by xrdb, and can be relocated by telling xrdb to merge a different file in your .xinitrc or .xprofile:

    xrdb -merge ~/.config/X11/Xresources
  • ~/.xscreensaver will probably need to stay.

  • ~/.xsession-errors is only created by the GDM display manager. The latest Git version of GDM puts it in $XDG_RUNTIME_DIR; otherwise it can be removed from within .xprofile. When using xinit, the xsession-errors file isn't created at all.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .