Monday, December 21, 2009

How to delete the 'Desktop' folder in Gnome...

...and not have the contents of your home directory displayed on your desktop.

Maybe its just me, but I really don't like the way that a fresh Gnome install sets up a user's home directory with a bunch of empty directories, like 'Video', 'Documents', and the totally evil 'Desktop' folder.  If you are like me, you want to decide what is in the home folder, which does not include all the extra directories they offer.  A reasonable person would expect that the quick and easy solution would be to delete the unwanted directories, but not so fast my friend.  All of the directories can be safely deleted, but one.  If you remove the 'Desktop' folder, you will end up with all the contents of your home directory (not including hidden files) displayed on your desktop.   Of course fixing your 'mistake' of deleting the Desktop folder is not as easy as doing a

mkdir ~/Desktop

No no, the wonderful people at Gnome must have thought that would be too easy.  No, first you must search around on the internet and find a post like this one.  Then you have to fire up your editor and do some editing, as well as replacing the folder 'Desktop.'  Then all will be well. Except for the fact that your home directory still has a folder in it that YOU DON'T WANT!!!1!

Anyway, the solution is pretty simple. You still have to have some sort of directory to point Nautilus to, but nobody says it can't be hidden.  Here is what you do:

Create a hidden directory like so:

mkdir ~/.desktop

Then open the file ~/.config/user-dirs.dirs with your favourite editor, eg:

vi ~/.config/user-dirs.dirs

In there you will see something like the following:

XDG_DESKTOP_DIR="$HOME/"
XDG_DOWNLOAD_DIR="$HOME/"
XDG_TEMPLATES_DIR="$HOME/"
XDG_PUBLICSHARE_DIR="$HOME/"
XDG_DOCUMENTS_DIR="$HOME/"
XDG_MUSIC_DIR="$HOME/"
XDG_PICTURES_DIR="$HOME/"
XDG_VIDEOS_DIR="$HOME/"


The line in red (above) is the one you want to change:

XDG_DESKTOP_DIR="$HOME/.desktop"

After this, you can kill nautilus (it should restart for you), or reboot your machine if you like, and your problem will be solved.  You will not have the ugly mess of unwanted directories in your home folder, nor will your home folder be displayed on your desktop any longer.

No comments:

Post a Comment