How to Add ‘Show Desktop’ Shortcut to Left Panel in Ubuntu 20.04

Want to get a shortcut icon to single click minimize all applications to show the desktop? Here’s quick guide shows you how to do it in Ubuntu running on both X and Wayland.

Ubuntu used to have a “Show Desktop” shortcut icon in left dock launcher. It allows you to single click minimize all visual app windows, and click again to restore them. The feature was however removed in recent Ubuntu releases.

If you’re just looking for a way to simulate the function, press Ctrl + Alt + D or Super + D on keyboard will do show desktop feature.

If you intend to add the “Show Desktop” shortcut icon, then this tutorial may help.

This tutorial will work on:

Though title says for Ubuntu 20.04, it also works on:

  • Ubuntu 18.04
  • Ubuntu 20.04
  • Ubuntu 20.10
  • Ubuntu 21.04

1. Create a simple show desktop script:

The command line tool wmctrl has a feature to toggle window manager’s “showing the desktop” mode.

1.) Firstly open terminal (Ctrl+Alt+T) and run command to install the tool:

sudo apt install wmctrl

2.) Then create local bin folder if you don’t have it:

mkdir ~/.local/bin

3.) Create a file called ‘show-desktop’ and open it via gedit text editor:

gedit ~/.local/bin/show-desktop

4.) When the file opens, paste following lines. The script will detect the “showing the desktop” mode status and toggle on or off depending on the value.

#!/bin/bash
status="$(wmctrl -m | grep "showing the desktop" | sed -r 's/(.*)(ON|OFF)/\2/g')"

if [ $status == "ON" ]; then
    wmctrl -k off
else
    wmctrl -k on
fi

5.) After saving the file, make it executable via command:

chmod +x ~/.local/bin/show-desktop

You can now test if the script works by running show-desktop command in terminal. (Log out and back in may required)

2. Create a shortcut for the script:

Now you have to create a shortcut for the script, so you can add it into the left (or bottom) dock launcher.

1.) Firstly open terminal and run command to create a .desktop file and open in gedit text editor:

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

2.) When it opens, paste following lines and save it.

[Desktop Entry]
Type=Application
Name=Show Desktop
Icon=desktop
Exec=show-desktop

3. Add the shortcut to the Dock:

Finally, click Activities or Show Applications and search for ‘Show Desktop’ (without quotes), right-click on the icon and select “Add to Favorites”

You’re done. Enjoy!

Merilyn Ne
Hi, I'm Merilyn Ne, a geek who has been working on Ubuntu Linux for many years and would like to write useful tips for beginners. Forgive me for language mistakes. I'm not a native speaker of English.