Add Trash to Action Bar on GNOME Desktop

As you probably know, in the Gnome desktop environment, as in other desktop environments, no matter which application you visit most often, you can add it to your Favorites menu under the Action Overview section. When you open Activity Overview, you will see a dashboard on the left side of your desktop with a list of your favorite applications. If you click on the grid icon at the bottom of the dash, you will see a grid listing all installed applications.

Therefore, 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 an 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 issue and how to add a trash can to the action bar on a Debian system. We will create a script to add the cart to the list of applications and then add it to favorites.

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

Step 1. Launch the Terminal application

We’ll be using Terminal to write a script to add the junk app to the list of installed apps. To open Terminal, go to the Actions tab in the upper left corner of your desktop. Then, in the search menu that appears, find the Terminal application and launch it.

Step 2. Write a script to place the trash in the list of applications.

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

$ nano ~/Documents/trashcan.sh

Then copy and paste the following lines into your 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=ApplicationnName=TrashnComment=TrashnIcon=user-trash-fullnExec=nautilus trash://nCategories=Utility;nActions=trash;nn[Desktop Action trash]nName=Empty TrashnExec='$HOME/Documents/trashcan.sh -e'n' > $icon
fi
;;
e)
gio trash --empty && echo -e '[Desktop Entry]nType=ApplicationnName=TrashnComment=TrashnIcon=user-trashnExec=nautilus trash://nCategories=Utility;nActions=trash;nn[Desktop Action trash]nName=Empty TrashnExec='$HOME/Documents/trashcan.sh -e'n' > $icon
;;
d)
while sleep 5; do ($HOME/Documents/trashcan.sh -r &) ; done
;;
esac
done

GNOME Recycle Bin in the Action Bar

After that press Ctrl + O to save and then Ctrl + X to close the editor.

Step 3. Run the bash script

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

$ chmod +x ~/Documents/trashcan.sh

Make the script executable

You can now run the script. To do this, run the following command in Terminal:

$ ./Documents/trash.sh -e

Run the Trsahcan script

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

Recycle Bin on the GNOME Desktop Activity Bar in Debian 10

Step 4. Add cart to action bar

Once the trash icon has been added to the app list, you can now easily add it to your favorites in the Dash menu on the left panel.

To do this, find the trash can icon in the list of installed applications. Then right click it and select Add to favourites option.

Add to favourites

After completing the above step, you will notice that a trash can icon is added to the left pane of the activity overview. Now you can easily access it whenever you want by simply pressing the super key and clicking the trash can icon.

Trash in the action bar

All you need to do is just run the script and add the application to your favorites, and you’re done! Hopefully this will be helpful whenever you need to add a trash can icon to your favorites in the action bar.

Add Trash to Action Bar on GNOME Desktop

Sidebar