How to add a "Show desktop" icon to the launcher?

13.04 and later

The show-desktop icon is now a toggle option via System Settings - Appearance

enter image description here


12.04 and earlier

You could install MyUnity Install MyUnity and there you will have the option to active "Show Desktop".

Note: As of May 2012, this places the Show Desktop icon above the Dash icon. This is a bug.

myunity app window


Only a workaround:

  1. Install xdotool
  2. Create a file ~/.local/share/applications/show-desktop.desktop
  3. Paste the following into that file:

    [Desktop Entry]
    Name=Show Desktop
    Exec=xdotool key --delay 300 super+d
    Icon=desktop
    Terminal=false
    Type=Application
    StartupNotify=true
    
  4. Make the file executable:

    Right click -> Properties -> Permissions -> Tick ‘Allow executing as a programme’

  5. Now browse to that file in Nautilus and drag it to the launcher:

enter image description here

The problem with this is, that you have to wait a bit after you started the launcher before you can start it again. So you can not quickly do hide -> unhide. It actually works via the command line, so maybe there's a way to fix this, but I have no idea how.

Update for 11.10:

In 11.10 the shortcut super+d doesn't seem to work anymore. Instead use ctrl+alt+d. However, the above mentioned problem remains.

Update for 12.04:

In 12.04 you will be able to enable a launcher item via ccsm (Ubuntu Unity Plugin options → Experimental tab):


(source: xrmb2.net)