KEuVUe149Y7e320zVKJqOjpo0SGIHzz7ueew9qo8
Bookmark

How to Add Show Desktop Button in Ubuntu 18.04 and 18.10 Gnome

Linuxslaves.com - Today I'm gonna show you a very quick tip to add "Show Desktop" icon in Ubuntu 18.04 and 18.10 dock. This feature has dropped since Ubuntu switched from Unity to Gnome as its default desktop environment.

But hey, there's shortcut button. You just need to hit combinations of Ctrl+Alt+D or Super+D to hide or show all opened app windows in Gnome.

It's quicker, so why?. Because why not.

Show Desktop Icon Ubuntu Gnome

The steps below tell you how to add a button to show the desktop in 18.10 Cosmic Cuttlefish and Ubuntu 18.04 Bionic Beaver dock using xdotool.

xdotool lets you programmatically (or manually) simulate keyboard input and mouse activity, move and resize windows, etc. It does this using X11's XTEST extension and other Xlib functions.

Here's how it look like :

Show Desktop Ubuntu 18

Please note, this doesn't work on Wayland session because it simulates X11 keyboard / mouse input events.

Suggested read :

Step 1 - The first thing you have to do is install the package. It's available in universe repository. Open terminal (Ctrl+Alt+T) and run the following :

sudo apt install xdotool

Type your password (no visual feedback), press Enter continue, and Y to confirm the installation.

Step 2 - Once installed, then run this command to create .desktop file :

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

You can change nano with your preferred Linux text editor like gedit, vim, code, sublime, etc.

Step 3 - Then add this code :

[Desktop Entry]
Type=Application
Name=Show Desktop
Icon=desktop
Exec=xdotool key --clearmodifiers Super+d

Create App Desktop

Press Ctrl+O to write out, Enter to save the changes, and Ctrl+X to exit nano.

Step 4 - Now open applications menu > search "Show Desktop" > right click the icon and select "Add to Favorites" as shown :

Pin to Dock Ubuntu

Show Desktop icon should show up on Ubuntu Dock / Dash to Dock. Thanks for reading!.