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.
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] Type=Application Name=Show Desktop Icon=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!
Excellent, thanks!
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.
CTRL+ALT+d works on Ubuntu Mate 18.08
Thank you, Ted McPherson, for this tip. Followed, and got to work.
This worked great! Thanks so much!
Thank you
nice
works great !!
That was easy and worked perfectly . Thanks Bruh
You are my hero! Thanks~
Worked like a cham
Awesome. Worked like a charm.
Is there a way to make it be the last button, at the bottom?
Drag and drop the icon to the last position at the ‘dash’.
Thanks !
thanks a lot
Thank you very much
Thank you, It worked just fine