79

I recently upgraded from 10.04 to 12.04, and there is no show desktop in the launcher. I know I can use Ctrl+Super+D, but is there a way to get it in the launcher?

Edit:
I just installed the "show desktop" icon on the launcher with MyUnity (see below) and it worked fine. It did not install the icon above Dash launcher, but well below it. That bug has apparently been fixed. This is as of 2012.9.30.

Anwar
  • 76,649
Aleksandar Maricak
  • 841
  • 1
  • 6
  • 4
  • 3
    As of 14.04, this is possible natively as per fossfreedom's answer. (Should that be the accepted answer?) MyUnity will not work from Quantal onwards, and the Experimental tab of the Unity plugin in CCSM does not exist in 14.04. – E.P. May 12 '14 at 17:34
  • 1
    Hey, could you consider changing the "accepted answer" to fossfreedom's native solution which presumably is more preferable and applicable to more people? – user69715 Feb 02 '15 at 19:11

15 Answers15

91

13.04 and later

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

enter image description here

fossfreedom
  • 172,746
30

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

Jeggy
  • 3,062
30

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)

Glorfindel
  • 971
  • 3
  • 13
  • 20
htorque
  • 64,798
  • wow, you are good! but why didn't they just build it this way? did they "forget" the show desktop-icon? it maskes working faster + easier. – melodram Mar 11 '11 at 22:03
  • @melodram I'm not sure how it can be easier than a keyboard shortcut but that might be just me. – Octavian Helm Mar 12 '11 at 13:39
  • 1 quicker way would be to use the command sequence super+d uses. I have seen those somewhere on askubuntu. I think is was called (minimize). Found it: http://askubuntu.com/questions/13709/is-there-a-keybind-to-minimize-all-windows-without-a-toggle Would that be faster? – Rinzwind May 05 '11 at 13:34
  • @melodram: You should probably "accept" this answer by clicking on the tick mark. Cheers! – Nicolas Raoul Jun 14 '11 at 02:12
  • Why would anyone want to show their desktop? – Jo-Erlend Schinstad Oct 17 '11 at 19:23
  • I hate to say it but I don't think this is good enough. I had this installed for a few days but it's just to buggy and I removed since it annoyed me too much. It seems to work very temperamentally – Kristofer Oct 17 '11 at 20:37
  • 1
    xdtools is not in the apt-get :( – The Student Dec 03 '11 at 00:12
  • @TomBrito Sorry, it's xdotool without the s at the end. – htorque Dec 03 '11 at 09:30
  • It works only on the first time I click. And it doesnt work to restore all windows when showing the desktop. The only working way for me is SUPER+D. – The Student Dec 04 '11 at 23:12
25

Ubuntu 12.10

To add "Show desktop" icon in Ubuntu 12.10:

  1. Launch Dconf Editor (from dash or otherwise).
  2. Go to com > canonical > unity > launcher.
  3. In favorites, add 'unity://desktop-icon'.

dconf-ediotr

This icon can now be repositioned by dragging and dropping.

Source

gioele
  • 406
  • 1
  • 7
  • 19
ignite
  • 8,936
16

You can also use compizconfig-settings-manager (ccsm) (instead of MyUnity) to adjust this setting.

Open CCSM, and click on Ubuntu Unity Plugin settings, then select the Experimental tab and check the box beside Show "Desktop Icon" in the launcher.

enter image description here

This will place the icon at the top of your dash, so you'll need to do as @Roland Taylor suggested and reset unity (unity --reset).


Additionally, you can show desktop using the Alt-Tab switcher

enter image description here

amc
  • 7,142
15

You can quickly show the desktop using the keyboard shortcut Ctrl + Super + D. I do not know of an option to use an icon.

Marco Ceppi
  • 48,101
Terry
  • 1,154
  • 1
    i hope they will create in icon for that, like in the gnome-panel. would make work easier and faster. – melodram Mar 11 '11 at 20:55
  • 1
    Or at least discoverable... Unity devs seem to think we're mind readers sometimes. – Scaine Mar 23 '11 at 21:47
  • And I'd just like to add - just installed 'Natty', and I switched immediately to the 'Classic Destop' - but even here, Ctrl-Alt-D does not work anymore -- one must use Super+D! Thanks for the tip, cheers! – sdaau Mar 25 '11 at 20:54
  • I am in complete love with all ubuntu news and bla bla but if I could slap the guy that decided to change the classical windows + d to show desktop to control-ald-d and then CHANGE IT BACK I'd feel really better. – Pitto May 22 '11 at 18:12
  • The question already clearly says that the user knows about Ctrl-Super-D, but is looking for a launcher icon shortcut. So it's useless to just reply "I don't know". – mivk May 29 '13 at 15:02
8

When you are using Unity you got animations activated and could then use an edge binding. Whit this you even don't have to click.

You can install CompizConfig Settings Manager from the Software Center go to 'General Settings' (1.) then to key bingings (2.) and there you can choose an edge to trigger 'Show Desktop' (3.). There you also have the option to set an individual keyboard shortcut.

show desktop with edge binding

joschi
  • 1,754
5

There is a "Show desktop" icon when alt-tabbing, so you can use alt-tab then shift-alt-tab to accomplish this.

4

Ubuntu 11.04


From webup8.org: (With slight modifications by me)

  1. Install wmctrlInstall wmctrl.

  2. Download the script and .desktop file, extract it and place the "showdesktop" script in the /usr/local/bin folder using the commands below:

    cd ~
    wget http://webupd8.googlecode.com/files/showdesktop.tar.gz
    tar -xvf showdesktop.tar.gz && rm showdesktop.tar.gz
    sudo mv showdesktop /usr/local/bin/
    

    If you want to manually download the file, get it from HERE.

  3. Now you should see a file called "showdesktop.desktop" in your home folder - you can move it wherever you want (or leave it there) and then simply drag it to the Unity launcher and you'll have a "Show desktop" icon.

Known issue: when clicking the "Show Desktop" icon in the Unity launcher, you'll have to wait until the icon stops pulsating before clicking it again (that's about 10 seconds) or else the it doesn't do anything. You can middle click when the icon is pulsating if you don't want to wait (thanks to Mahdi for the tip!).

Isaiah
  • 59,344
  • Thanks, I prefer this to the answers in the other question this was closed as a duplicate of, since I already use wmctrl for other things. (Perhaps worth posting there in case this one gets deleted.) – T.J. Crowder Oct 19 '11 at 09:59
3

Reset Unity (unity --reset), and then reenable it, to put it back in the right place.
enter image description here

RolandiXor
  • 51,541
  • 1
    Despite toggling the setting for show desktop in ccsm and running unity --reset as suggested, I can't move the button anywhere on the launcher. Thankfully the bug report shows that a fix should be on the way :) – askuhn Apr 28 '12 at 04:45
  • @askuhn I never said you could move it "anywhere on the launcher". – RolandiXor Apr 28 '12 at 14:59
  • Sorry, to clarify, when I said "anywhere" I also meant below the workspace icon as in your screenshot...I can't even get it down there ("unity --reset" just makes it disappear altogether for me). – askuhn Apr 28 '12 at 15:47
  • @askuhn oh I forgot to mention, after running unity --reset you have to enable it again. – RolandiXor Apr 28 '12 at 18:44
  • I did try that with no luck...the icon still placed itself above the BFB. I'm fine waiting for the update though, thanks for your help! – askuhn Apr 28 '12 at 22:38
  • In 12.10 you can move the button by clicking on it, waiting a couple seconds then dragging it around. – Dave Oct 25 '12 at 15:09
2

For 12.10

Unity patch team at work!

We have created a script that lets you enable/disable show-desktop icon. If you dont want to install a separate tool, grab our script and run it.

It is hosted on bitbucket at https://bitbucket.org/jpmahesh/unity-reset

Or if you are lazy and prefer not to open another page, here's the snippet.

#!/usr/bin/python

from gi.repository import Gio
import argparse

parser = argparse.ArgumentParser(description='Enable or disable show-desktop icon')
optiongroup=parser.add_mutually_exclusive_group(required=True)
optiongroup.add_argument('-e','--enable',action='store_true',help='Add show-desktop icon to launcher')
optiongroup.add_argument('-d','--disable',action='store_true',help='Remove show-desktop icon from launcher')
args=parser.parse_args()

gsettings=Gio.Settings("com.canonical.Unity.Launcher")
launcherfav=gsettings.get_strv('favorites')
shwdsktp="unity://desktop-icon"
def remove_show_desktop():
  if shwdsktp in launcherfav:
    print "Show desktop is currently enabled."
    print "Removing show desktop"
    launcherfav.remove(shwdsktp)
    gsettings.set_strv('favorites',launcherfav)
    print "DONE"
  else:
    print "Looks like the show desktop icon is already hidden"
    print "Nothing to do then. Tada!"

def add_show_desktop():
    if shwdsktp not in launcherfav:
        print "Show desktop icon is currently hidden"
        print "Adding it to launcher"
        launcherfav.append(shwdsktp)
        gsettings.set_strv('favorites',launcherfav)
        print "DONE"
    else:
        print "Looks like the show-desktop icon is already visible"
        print "Nothing to do then. Tada!"

if args.enable :
    add_show_desktop()
if args.disable :
    remove_show_desktop()

Usage:

Save the above code in a file called show-desktop.py and in a terminal, run:
python show-desktop.py -e to show the icon
python show-desktop.py -d to hide it.
python show-desktop.py -h to see the usage message.

By default(without any arguments), it just prints the usage message and exits.

Mahesh
  • 12,738
1

if using xubuntu or xfce desktop you can just go to your panel and right click. go to preferences/items/add new item and choose show desktop

1

Based on graphical procedure already described here.

We can copy and paste the following command to do this for us:

Add show desktop if not already present

key=/com/canonical/unity/launcher/favorites; new="'unity://desktop-icon'"; dconf read $key | grep -q "$new" || dconf write $key "$(dconf read $key | sed "s%^\[%[$new, %")"

Similarly we could remove it again:

Remove show desktop if present

key=/com/canonical/unity/launcher/favorites; new="'unity://desktop-icon'"; dconf read $key | grep -q "$new" && dconf write $key "$(dconf read $key | sed "s%$new, %%")"
d a i s y
  • 5,511
user167733
  • 11
  • 1
0

I found that this link here did the trick. Though it's more of an application than a feature.

Hope it helps!

0

You can also use ubuntu-tweak (instead of MyUnity/compizconfig) to adjust the setting.

Flori
  • 101