When you right click on the "Trash" icon you'll have "Empty Trash" included in the dropdown menu. When selected it will show the number of items in the trash and ask to confirm deletion. Just like Mother Nature intended.
All the commands/steps are shown below. If you're wary of using wget, and what the files may contain, I'll include the contents at the bottom so you can look them over and manually copy/paste the files to the proper location.
First install "trash-cli"
Code: Select all
sudo apt-get update
sudo apt-get install trash-cliCode: Select all
mkdir --parents $HOME/.local/share/file-manager/actionsCode: Select all
wget -O $HOME/.local/share/file-manager/actions/ask-trash-empty.desktop https://raw.githubusercontent.com/NicolasBernaerts/ubuntu-scripts/master/lubuntu/trash-empty/ask-trash-empty.desktopCode: Select all
sudo wget -O /usr/local/bin/ask-trash-empty https://raw.githubusercontent.com/NicolasBernaerts/ubuntu-scripts/master/lubuntu/trash-empty/ask-trash-empty
sudo chmod +x /usr/local/bin/ask-trash-empty________________________________________________
If you prefer to do it manually rather than using "wget":
Contents of "ask-trash-empty.desktop". Put it in "~/.local/share/file-manager/actions".
Code: Select all
[Desktop Entry]
Type=Action
Profiles=profile-zero;
Name[en_US]=Empty Trash
Name[en]=Empty Trash
Name[C]=Empty Trash
Name[fr_FR]=Vider la corbeille
[X-Action-Profile profile-zero]
MimeTypes=inode/directory;
Basenames=trash:///
Exec=/usr/local/bin/ask-trash-empty
Name[en_US]=Empty Trash
Name[en]=Empty Trash
Name[C]=Empty Trash
Name[fr_FR]=Vider la corbeilleCode: Select all
#!/bin/sh
# -------------------------------------------------------
# Script used to empty trash from context menu
#
# Used in http://bernaerts.dyndns.org/linux/...
#
# 01/11/2014, V1.0 - Creation by N. Bernaerts
# -------------------------------------------------------
# retrieve number of files in the trash
TRASH_QTY=`/usr/bin/trash-list | wc -l`
# ask for confirmation
[ "$TRASH_QTY" != "0" ] && zenity --question --title="" --text="Trash contains $TRASH_QTY items.\n\nDo you want to empty it ?"
# if answer is yes, empty trash
[ "$?" = "0" ] && /usr/bin/trash-empty