40

As of now, my desktop has begun showing the contents of my home folder (~) instead of the contents of ~/desktop. I must have changed something, but I have no idea what, or what I was doing exactly when it happened.

How do I re-point gnome to the right folder?

I'm running Ubuntu 11.04.

Bruno Pereira
  • 73,643
Tomas Aschan
  • 2,922

9 Answers9

76

If gconf doesn't work, open your home directory and press Ctrl+H to show hidden files. Look in .config for user-dirs.dirs and be sure it resembles this:

XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/Work"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_VIDEOS_DIR="$HOME/Videos"
Eliah Kagan
  • 117,780
wojox
  • 11,362
  • Great! This was exactly what I was looking for! – Tomas Aschan May 22 '11 at 23:59
  • 1
    I notice when I set the configs this doesn't work, but I realize may I need to reboot the computer, when I did it, the changes affect now, Thanks! – Marvin Nov 01 '22 at 02:11
  • ok, reboot needed – kiltek May 24 '23 at 13:25
  • In Ubuntu 22.04, before applying this solution, I had to remove symbolic links to the Desktop and some other folders like Music, Videos, etc., and re-create them. Otherwise, it doesn't affect the situation. rm ~/Desktop and then mkdir -p ~/Desktop. Note that my Desktop folder was empty, I don't know what happens otherwise. – Caglayan DOKME Mar 05 '24 at 05:02
13

Press Alt + F2 and type/copy:

gconftool-2 --set --type bool /apps/nautilus/preferences/desktop_is_home_dir false

You probably need to log out and back in again (alternatively, you can run nautilus -q to restart just Nautilus).

htorque
  • 64,798
7

I think if you run this command:

vim ~/.config/user-dirs.dirs

you'll find:

XDG_DESKTOP_DIR="$HOME"

but it should have /Desktop like this:

XDG_DESKTOP_DIR="$HOME"/Desktop 

So just run the command mkdir Desktop and then change the line in ~/.config/user-dirs.dirs.

The other lines should look like this:

XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/Work"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_VIDEOS_DIR="$HOME/Videos"
Zanna
  • 70,465
user179283
  • 71
  • 1
  • 1
6

Press alt f2 and type gksu gconf-editor and navigate to apps -> nautilus -> preferences. Have a look at:

im2

Rinzwind
  • 299,756
3

This is what helped me

sudo -H gedit ~/.config/user-dirs.dirs

And replaced XDG_DESKTOP_DIR="$HOME" with XDG_DESKTOP_DIR="$HOME/Desktop"

# 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_DESKTOP_DIR="$HOME/Desktop"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_VIDEOS_DIR="$HOME/Videos"
Zanna
  • 70,465
  • 2
    Shouldn't need sudo and you probably don't want to risk changing ownership. Mine is .rw------- $USER. Thanks for the tip. – bvargo Jan 06 '23 at 06:25
2

This is most likely due to the ~/Desktop directory got deleted. If the folder ~/Desktop does not exist, xdg-user-dirs-update will change ~/.config/user-dirs.dirs entry to:

XDG_DESKTOP_DIR="$HOME"

Run the following commands to fix the problem:

cd ~
mkdir Desktop

vi ~/.config/user-dirs.dirs

And replace XDG_DESKTOP_DIR="$HOME" with XDG_DESKTOP_DIR="$HOME/Desktop"

# 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_DESKTOP_DIR="$HOME/Desktop"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_VIDEOS_DIR="$HOME/Videos"

You will need to log out and back in again or reboot for the changes to take effect.

stumblebee
  • 3,547
2

This might happen after removing the desktop directory as it’s documented in man xdg-user-dirs-update (grammar corrected):

Additionally, any configured directories that point to non-existing locations are reset by pointing them to the user’s home directory. (…) xdg-user-dirs-update is normally run automatically at the start of a user session to update the XDG user dirs according to the user’s locale.

To reset this, you can run xdg-user-dirs-update --force1, then log out and in.

Update existing user-dirs.dir, but force a full reset. This means: Don't reset nonexisting directories to HOME, rather recreate the directory.


1 Don’t do this if you have configured some directories to point to a non-standard path. In such a case, edit the file ~/.config/user-dirs.dirs manually.

Melebius
  • 11,431
  • 9
  • 52
  • 78
1

Some folders in my $HOME such as Desktop and Templates, were always empty and never being used, so I removed them. Then after upgraded from Ubuntu 18.04 to 20.04, all the files and directories including the hidden ones suddenly all displayed on the desktop. As suggested, edit ~/.config/user-dirs.dirs to point the XDG_DESKTOP_DIR back to "$HOME/Desktop". Of cause, do mkdir ~/Desktop, then logout and login back, voilà, everything is good!

hhzhu
  • 111
0

Following command works on Ubuntu 12.10.

gconftool-2 --set --type bool /apps/nautilus/preferences/desktop_is_home_dir false
d a i s y
  • 5,511