News:

SMF - Just Installed!

Main Menu

trash can for gnome dash/dash to dock

Started by mahesh, Nov 28, 2023, 07:10 AM

Previous topic - Next topic

mahesh

alright peoples final script. should be user neutral just place in $HOME/Documents & make executable.
alright peoples final script. should be user neutral just place in $HOME/Documents & make executable.

Code:
#!/bin/bash
icon=$HOME/.local/share/applications/trash.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/trash.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/trash.sh -e'\n' > $icon
;;
    d)
while sleep 5; do ($HOME/Documents/trash.sh -r &) ; done
;;
  esac
done
once placed in Documents, open a terminal there, run-> trash.sh -e <- this will create trash.desktop in $HOME/.local/share/applications

final piece, you need to add to autostart-> trash.sh -d

example of my ~/.config/autostart/trash-icon.desktop:
Code:
[Desktop Entry]
Type=Application
Name=Trash Icon
Icon=user-trash
Exec=/home/user/Documents/trash.sh -d
enjoy your new trash icon for dash/dash to dock.