I somehow deleted my Desktop from nautilus places

I somehow deleted my Desktop from nautilus places, it does not show in the places part of Nautilus anymore as you can see from the picture.

Nautilus places

And also now my Desktop lists the contents of my home folder, not the Desktop folder. How can I fix this? I use Ubuntu 14.04 and GNOME 3.


Solution 1:

Edit the .config/user-dirs.dirs file by pasting this in a terminal:

gedit ~/.config/user-dirs.dirs

You will see text that looks like this:

# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
# 
XDG_DOWNLOAD_DIR="/data/downloads"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/"
XDG_DOCUMENTS_DIR="/data/drive"
XDG_MUSIC_DIR="/data/music"
XDG_PICTURES_DIR="/data/pictures"
XDG_VIDEOS_DIR="/data/videos"
XDG_DESKTOP_DIR="/data/desktop"

The XDG_DESKTOP_DIR= entry should be equal to your desktop folder (probably "$HOME/Desktop"). If it is missing, just type it in and save the file. Reboot and it should be back.