Add ‘Show Desktop’ to Dock Panel in Ubuntu 21.10, 20.04 & 18.04

Last updated: September 27, 2021

This simply tutorial shows how to add a ‘Show Desktop‘ icon into the left dock panel in Ubuntu 21.10, Ubuntu 20.04, or Ubuntu 18.04 with default GNOME desktop.

The ‘Show Desktop‘ button was dropped since Ubuntu switched to Gnome 3 Desktop. For those using desktop app shortcuts, it’s useful to have a button to toggle display blank desktop quickly. And to add it back, you can manually create shortcut icon to do the trick and add it to panel (dock).

As you may know, the keyboard shortcuts Ctrl+Alt+d or Super+d do the function hide or show all opened app windows. And following steps will create a ‘show desktop’ shortcut icon simulates the keyboard press (Super+d) via the xdotool tool.

NOTE that following steps don’t work on Wayland session, since xdotool simulates X11 keyboard/mouse input events.

1. Install xdotool:

Xdotool is a command-line X11 automation tool, that allows to simulate keyboard input and mouse activity, move and resize windows, etc.

To install it, open terminal either by pressing Ctrl+Alt+T key combination on keyboard, or by searching from the activities overview screen. When terminal opens, paste the command below into it and hit run:

sudo apt-get install xdotool

Type your user password (no asterisk feedback) when it prompts and answer y to confirm.

2. Create a shortcut icon for Show Desktop:

Most Linux distributions identify app shortcut icons via .desktop file under “/usr/share/applications” for global or ‘.local/share/applications’ for local user only.

To create an app shortcut in the case, run command in terminal:

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

This command will create and also open it via gedit text editor. When the file opens, copy and paste the lines below and save it.

[Desktop Entry]
Name=Show Desktop
Exec=xdotool key --clearmodifiers Super+d

3. Add show desktop to dock panel:

After created the shortcut, either press Windows (or Super) key on keyboard or click upper-left corner ‘Activities’ to bring up the overview screen.

Then search for ‘Show Desktop’ (without quotes), right-click on the result icon and select ‘Add to Favorites’.

Finally, you’ll see the ‘Show Desktop’ icon on the dock panel. As mentioned, it works only on Xorg session. For Ubuntu 21.04 and higher, you may need to choose ‘Ubuntu on Xorg‘ from the login screen via the gear button.

That’s all. Enjoy!


I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via [email protected]

17 responses to Add ‘Show Desktop’ to Dock Panel in Ubuntu 21.10, 20.04 & 18.04

  1. Excellent, thanks!

  2. Thanks — I installed it in 18.10 and it works.
    At first it did not work. The button as written above emulates the keys Super+d, and Ubuntu18.10 uses Ctrl+Super+d by default. I looked up the keyboard shortcuts: Show Applications, Settings, Devices, Keyboard. Under “Hide all windows” the keyboard shortcut was Ctrl+Super+d. I clicked on the setting and changed it to Super+d to match with the new button. It now works fine.

  3. This worked great! Thanks so much!

  4. Thank you

  5. nice

    works great !!

  6. That was easy and worked perfectly . Thanks Bruh

  7. You are my hero! Thanks~

  8. Worked like a cham

  9. Lucy Dixon Hendry March 21, 2019 at 10:57 am

    Awesome. Worked like a charm.

  10. Is there a way to make it be the last button, at the bottom?

  11. Thanks !

  12. thanks a lot

  13. Thank you very much

  14. Thank you, It worked just fine