You actually want to disable the Desktop
directory and prevent the DE to automatically recreate it.
Short answer:
Edit ~/.config/user-dirs.dirs
and change XDG_DESKTOP_DIR
value to $HOME
:
XDG_DESKTOP_DIR="$HOME"
Long answer:
How to disable/relocate the User Directories (Desktop, Pictures, Documents etc) ?
On a freedesktop
compliant DE this is done via the XDG
user directories configuration file, namely $(XDG_CONFIG_HOME)/user-dirs.dirs
:
$(XDG_CONFIG_HOME)/user-dirs.dirs specifies the current set of
directories for the user.
If not set or empty, XDG_CONFIG_HOME
defaults to ~/.config
so, for most users, the file in question is ~/.config/user-dirs.dirs
.
Applications read this file to find those directories. The file consists of key=value
pairs, one per line.
The default locations are:
XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_TEMPLATES_DIR="$HOME/.Templates"
XDG_VIDEOS_DIR="$HOME/Videos"
To relocate a certain directory edit the config file and replace the current value with the location of your choice, e.g.
XDG_DOCUMENTS_DIR="/run/media/mybackupdrive/documents"
To disable a certain directory point it to the home directory:
XDG_DESKTOP_DIR="$HOME"
For those who prefer a CLI tool, XDG provides xdg-user-dirs:
Relocate VIDEOS:
xdg-user-dirs-update --set VIDEOS /media/bkdrive/myvideos
Query current location for VIDEOS:
xdg-user-dir VIDEOS
/media/bkdrive/myvideos
Note:
After configuring user-dirs.dirs
, if some User Dirs are on drives that are not accessible at startup you might want to disable /etc/xdg/user-dirs.conf
(if present on your system), i.e. edit the enabled
line to read:
enabled=False
see this discussion for more details.