Software & AppsOperating SystemLinux

How To Add ‘Show Desktop’ Button to GNOME Dash or Ubuntu Dock

Ubuntu 9

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 (Ctrl + Super + 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.

Quick Answer

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.

Prerequisites

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 xdotool:

sudo apt install xdotool

Here, 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:

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

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:

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

Here’s what each line does:

  • [Desktop Entry] specifies that this file is a desktop entry.
  • Type=Application indicates that this desktop entry launches an application.
  • Name=Show Desktop sets the name of the desktop entry.
  • Icon=desktop sets the icon for the desktop entry.
  • Exec=xdotool key --clearmodifiers Super+d is the command that will be executed when the desktop entry is clicked. It tells xdotool to simulate the Super+d keypress, 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.

Conclusion

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!

Can I add a ‘Show Desktop’ button to the GNOME Dash or Ubuntu Dock without using the command line?

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.

How do I install xdotool?

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.

Leave a Comment

Your email address will not be published. Required fields are marked *