3

Is there a way to safely remove the desktop icon from my home folder?

I tried to deleting it or change to .Desktop in CLI but these didn't help and I restored it to avoid problems. Any other trick?

I want to do so from considerations of minimalism (I can already access the desktop itself if I close or minimize dirs).

enter image description here

Pilot6
  • 90,100
  • 91
  • 213
  • 324
  • 1
    You mean the purple icon? If so: move the Desktop to another place (outside /home). see users-dirs.dirs in ~/.config – Rinzwind Jan 27 '17 at 16:46

2 Answers2

5

In your desktop environment (GNOME/Unity) and most others, the files and folders on your desktop are really in ~/Desktop. If you remove that folder, those files will be gone and -- even if you don't care about that -- your desktop won't work properly.

Instead, you will want to change what folder is actually used for your desktop, so that it is no longer ~/Desktop but something else (perhaps ~/.Desktop, as you suggested). This cannot be achieved by renaming the folder, because this setting (and most other settings involving files and folders) keeps track of the folder by its name, and not by its inode number.

To cause a folder other than ~/Desktop to be used as your desktop folder, you can do the reverse of the method given in How can I change the desktop folder path? and How to set the desktop to $HOME/Desktop? (Those questions are oriented to the situation where someone's desktop folder has accidentally gotten changed to something else and the user wants to change it back.)

  1. Create the folder you wish to use. For these instructions, I will suppose you want to use ~/.Desktop. This is the main step that applies in your case but not in those questions, where the desired folder was ~/Desktop and already existed.

  2. Open ~/.config/user-dirs.dirs in a text editor. You don't need to (and should not) edit this as root, or anything. It belongs to your user account.

  3. Find the line that says:

    XDG_DESKTOP_DIR="$HOME/Desktop"
    

    Change it to whatever you like. If you want .Desktop instead of Desktop, use:

    XDG_DESKTOP_DIR="$HOME/.Desktop"
    

    In the rare case that no such line is present in the file, simply add it. It can go anywhere, but I suggest putting it above all the other lines that are not commented out (i.e., that don't start with #), since that's where it's normally found.

  4. Save the file and close the text editor.

  5. Log out back in. (Rebooting works too, of course, but is unnecessary.)

  6. Verify that the change was successful -- that you see the contents of the new directory on your desktop, and that creating or removing items causes them to be created or removed in the new directory.

  7. Remove, rename, or move the old directory, if desired. You said you don't want to see Desktop in your home folder. Since at this point it's no longer your desktop folder, you can do whatever you like with it.

These instructions are not specific to Unity and should work with most other graphical interfaces on Ubuntu that implement the desktop metaphor.

Eliah Kagan
  • 117,780
0

In your home folder create a file named .hidden

In it add "Desktop" without quotes. Save

When you re-open your home folder, it will be gone.

Alternatively from the terminal: echo "Desktop" >> ~/.hidden

To see it again, remove "Desktop" from the .hidden file or remove the .hidden file.

Jean-Marie
  • 1,958
  • 1
  • 14
  • 11