I am migrating from Unity to GNOME. One item I am missing is a "Show desktop" button (aka "minimise all windows") in the dash. How can I add this functionality to the GNOME dash (or Ubuntu dock in Ubuntu 17.10 and later), even if it means making a custom .desktop file?

(I know that I can use the Ctrl + Super + D keyboard shortcut to show the desktop and that I can install an extension to add a "Show desktop" button to the top bar, but I specifically want a button in the dash.)

up vote 30 down vote

I found a way to do that:

  1. Open a terminal and install wmctrl:

    sudo apt-get install wmctrl
  2. Create a shell script named show-desktop.sh (I put it in my home folder)

    gedit ~/show-desktop.sh

    place this code in there:

    status="$(wmctrl -m | grep "showing the desktop" | sed -r 's/(.*)(ON|OFF)/\2/g')"
    if [ $status == "ON" ]; then
        wmctrl -k off
        wmctrl -k on

    and make it executable:

    chmod +x ~/show-desktop.sh
  3. Create a file show-desktop.desktop in ~/.local/share/applications/ folder:

    gedit ~/.local/share/applications/show-desktop.desktop

    Add this text and save (don't forget change the value on <your user>):

    [Desktop Entry]
    Name=Show Desktop
    Exec=/home/<your user>/show-desktop.sh
  4. Open the dash, search for show desktop and add it to the favorites.

  • 6
    Tested and working also on Ubuntu 18.04 LTS. This is the best way I've found to do it since they removed the 'Add show desktop icon to the launcher' option from System Settings / Appearance / Behaviour panel. It was such an useful feature. Sometimes I really do not understand Ubuntu developers... – bytepan Apr 29 at 9:30
  • 4
    In the file "show-desktop.desktop" (topic 3), I changed "Icon=show-desktop" to "Icon=desktop",because the previous one was not working. – samuelcersosimo May 20 at 3:56
  • This is not beginner friendly. How do I create a file in the applications folder? I can't just create it and save it there through the gui because it's protected. Thanks. – Rabbit Sep 1 at 12:06
  • 2
    @Rabbit you need to use root privileges. Open a terminal and type: sudo nano /use/share/applications/show-desktop.desktop – AndAC Sep 1 at 12:10
  • 1
    @Rabbit I understand. I do think this could be better explained. Maybe someone with a better English could edit my post to make it easier for beginners. – AndAC Sep 1 at 12:41

protected by Community Jul 30 at 14:40

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.