If you’re a regular user of the GNOME Dash or Ubuntu Dock, you might find it convenient to have a ‘Show Desktop’ button readily available. This button minimizes all open windows and displays the desktop. While there’s a keyboard shortcut for this (
D), having a button can be more intuitive for some users. In this guide, we’ll walk you through two methods to add a ‘Show Desktop’ button to your GNOME Dash or Ubuntu Dock.
To add a ‘Show Desktop’ button to GNOME Dash or Ubuntu Dock, you can either use the xdotool command-line tool or install a GNOME Shell extension. The xdotool method involves installing the tool and creating a desktop entry, while the extension method requires installing a GNOME Shell extension from the Ubuntu Software Center.
Before we begin, make sure you have administrative access to your Ubuntu system. You’ll need to install a small tool and create a new file, which requires root privileges.
Method 1: Using xdotool
Step 1: Install xdotool
xdotool is a command-line tool that lets you simulate keyboard input and mouse activity, move and resize windows, etc. We’ll use it to simulate the ‘Show Desktop’ keyboard shortcut.
Open a terminal and run the following command to install
sudo apt install xdotool
sudo runs the command with root privileges,
apt is the package handling utility in Ubuntu, and
install is the command to install a package.
xdotool is the name of the package we’re installing.
Step 2: Create a Desktop Entry
Next, we’ll create a desktop entry for our ‘Show Desktop’ button. This is essentially a shortcut that will execute a command when clicked.
Run the following command to create and open a new desktop entry file in the text editor:
In this command,
gedit is a text editor, and
~/.local/share/applications/show-desktop.desktop is the path where we’re creating the new file.
Step 3: Configure the Desktop Entry
In the text editor, paste the following lines:
Exec=xdotool key --clearmodifiers Super+d
Here’s what each line does:
[Desktop Entry]specifies that this file is a desktop entry.
Type=Applicationindicates that this desktop entry launches an application.
Name=Show Desktopsets the name of the desktop entry.
Icon=desktopsets the icon for the desktop entry.
Exec=xdotool key --clearmodifiers Super+dis the command that will be executed when the desktop entry is clicked. It tells
xdotoolto simulate the
Super+dkeypress, which is the ‘Show Desktop’ shortcut.
Save the file and close the text editor.
Step 4: Add to Favorites
Finally, search for “show desktop” in the application menu, right-click on the “Show Desktop” icon, and select “Add to Favorites”. The ‘Show Desktop’ button will now appear in your GNOME Dash or Ubuntu Dock.
Method 2: Using a GNOME Shell Extension
If you prefer not to use the command line, you can install a GNOME Shell extension that provides a ‘Show Desktop’ button.
Open the Ubuntu Software Center, search for “show desktop”, and install one of the available extensions. Once installed, the ‘Show Desktop’ button will appear in your GNOME Dash or Ubuntu Dock.
Note: This method may not be available in Ubuntu 20.04 Focal.
Adding a ‘Show Desktop’ button to your GNOME Dash or Ubuntu Dock can help streamline your workflow and make it easier to manage your windows. Whether you prefer using the command line or a GUI, there’s a method that will work for you. Happy computing!
Yes, you can install a GNOME Shell extension from the Ubuntu Software Center to add a ‘Show Desktop’ button to your GNOME Dash or Ubuntu Dock. However, please note that this method may not be available in Ubuntu 20.04 Focal.
To install xdotool, open a terminal and run the command
sudo apt install xdotool. This will install the xdotool package using the apt package handling utility in Ubuntu.