This seems like a great time to subscribe my RSS !

If you like me like to have icons on desktop but sometimes need to just hide everything to better concentrate on what you’re doing you may like this little bash script I came out with. (warning: this post applies only to gnome)


Verify you have gconf2 installed. Do that with: sudo apt-get install gconf2.

You need a folder where to store this script (along with other scripts maybe), so make one or just use your home folder. So, open this folder and create an empty file. Call it or something like that. Open it with gedit and paste this text in the file.


if [ $(gconftool-2  --get /apps/nautilus/preferences/show_desktop) == "true"  ]; then
	echo "disabling desktop"
	gconftool-2   --type boolean --set /apps/nautilus/preferences/show_desktop "false"
	echo "enabling desktop"
	gconftool-2   --type boolean --set /apps/nautilus/preferences/show_desktop "true"

# nautilus may crash ( !#£%$$@à###!!!! )

echo "checking if nautilus is still up"
sleep 1
if [ $( ps xa | grep nautilus | grep -v grep ) -z ]; then
	echo "nautilus is not up or crashed. Restarting nautilus"
	nautilus -n &
	echo "everything done."
	echo "all good - finishing job"

Done ? Save it and close gedit. Right click it, choose properties, then permissions and mark the file as executable.

Now all you need to do is double click it to hide or show your desktop icons. You may want to drag the file to your panel to access it more easily:

Note: There are a few shortcomings.

  1. The first is that when you hide your icons, you cannot anymore right click on the desktop. Nor changing desktop background works, it will get applied when you show your icons again.
  2. The second thing is that while hiding your desktop is quite fast showing it again may take 1 second or two and your window manager may become unresponsive in the meantime.
  3. Third thing to keep in mind: sometimes nautilus just crashes. I’ve included a quick check in the script to restart it. Nautilus crashing means it could just wipe (close) away all you’re opened file browsers. In my tests I’ve never one file browser wiped away, but it could happen. Nothing dangerous, only annoying.

3 Responses

  1. joe

    Did just like you said and nothing. Does it requre sudo to run?

    Hardy Heron
    Compiz turned off and on
    Gnome of course cause KDE is the devil

  2. Stefano Forenza

    @Joe: no, it doesn’t require sudo and shuold not be run with sudo (because that would change the settings of the root user, not your user’s).

    Check if you have gconf2 installed. sudo apt-get install gconf2.

    Otherwise, I’d suggest taking a look at the script output to understand where it fails

  3. gconftool-2 –type boolean –set /apps/nautilus/preferences/show_desktop “false”
    Not only hides desktop but also disables right click action on desktop.

Leave a comment