Roland's homepage

My random knot in the Web

Preventing the ~/Desktop direcory

Some programs like e.g. Firefox have the annoying habit of creating a Desktop directory in your $HOME directory. It seems this is driven by the freedesktop specification, specifically xdg-user-dirs.

Since I prefer a simple window manager to a complex and overweight “desktop environment”, this behavior annoys me to no end. Luckily there is a way to turn it off.

Create a file named user-dirs.dirs in the directory ~/.config. This file should contain at least the following line:

XDG_DESKTOP_DIR="/home/<username>/"

You should of course substitute your own username for <username>.

There are several values that you can set in this file. Most of them only matter when you use a desktop environment. The defaults (without the XDG_ prefix and _DIR suffix) are defined in user-dirs.defaults.

Some sources say that it is OK to use shell variables (like $HOME) in the paths. Others disagree. So it seems best not to rely on that and use plain absolute directory names.


←  Initializing a new git repo for a project Installing OpenProject on FreeBSD  →