Add Trash Can to Activities Panel in GNOME Desktop

As you may know, in Gnome desktop environments, as in other desktop environments, no matter which application you access most often, you can add it to your Favorites menu under the Activities Overview. When you open the Activities Overview, you will see a dash panel on the left side of the desktop with a list of your favorite applications. If you click the grid icon at the bottom of the dash, you'll see a grid that lists all installed applications.

So if you need to add an application to the Favorites menu, simply right-click the application and select the "Add to Favorites" option. But how do you add the application to the Favorites menu that is not in the list of installed applications, such as the Trashcan application? If you search for it, you will not find it in the list of installed applications.

In this article we will learn how to work around this problem and how to add the Trashcan to the Activities panel in the Debian system. We will create a script to add the trash can to the list of applications and then add it to your favorites.

We have used Debian 10 to execute the commands and procedures mentioned in this article.

Step 1: Launch the Terminal application

We will use Terminal to write the script for adding the trash application to the list of installed applications. To open the Terminal, go to the Activities tab in the top left corner of your desktop. Then from the search menu that appears, search for the Terminal application and launch it.

Step 2: Write a Script to put Trashcan to the Applications list

You can use any text editor for creating a script. In this article, we will use the Nano text editor to create a script named "trashcan.sh". In the Terminal, run the following command in order to create a script using nano editor:

$ nano ~/Documents/trashcan.sh

Write trashcan script

Then copy paste the following lines in the script file:

#!/bin/bash
icon=$HOME/.local/share/applications/trashcan.desktop
while getopts "red" opt; do
case $opt in
r)
if [ "$(gio list trash://)" ]; then
echo -e '[Desktop Entry]\nType=Application\nName=Trash\nComment=Trash\nIcon=user-trash-full\nExec=nautilus trash://\nCategories=Utility;\nActions=trash;\n\n[Desktop Action trash]\nName=Empty Trash\nExec='$HOME/Documents/trashcan.sh -e'\n' > $icon
fi
;;
e)
gio trash --empty && echo -e '[Desktop Entry]\nType=Application\nName=Trash\nComment=Trash\nIcon=user-trash\nExec=nautilus trash://\nCategories=Utility;\nActions=trash;\n\n[Desktop Action trash]\nName=Empty Trash\nExec='$HOME/Documents/trashcan.sh -e'\n' > $icon
;;
d)
while sleep 5; do ($HOME/Documents/trashcan.sh -r &) ; done
;;
esac
done

GNOME Trashcan in Activity Panel

Once done, press Ctrl+O to save and then Ctrl+X to close the editor.

Step 3: Run the bash script

First, you will need to make our script executable. To do so, run the following command inĀ  Terminal:

$ chmod +x ~/Documents/trashcan.sh

Make the script executable

Now you can execute the script. Run the following command in Terminal to do so:

$ ./Documents/trash.sh -e

Run Trsahcan script

After executing the script, the trash icon will be added to your installed applications list. To find it, hit the super key on your keyboard and search for trash can either using the search bar or manually find it in the applications list.

Trashcan in activity panel in GNOME Desktop on Debian 10

Step 4: Add the Trashcan to the Activities panel

Once the trash icon is added to the list of applications, now you can easily add it as Favorites to the Dash menu at the left panel.

To do so, find the trash icon in the list of installed applications. Then right-click it and select the Add to Favorites option.

Add to Favorites

After following the above step, you will notice the Trash icon has added to the left panel of Activities overview. Now you can easily access it whenever you want to by simply hitting the super key and clicking on the Trash can icon.

Trashcan in Activities Panel

So all you need is, simply run the script and add the application as favorites, and there you go! I hope it will be helpful whenever you need to add the trash icon to your Favorites list in the Activities panel.