alright, i got working trash on my dash to dock.
i'm sure there are other ways to do it, this is the way i did it trying to keep it simple with the same results every time, doesn't spawn the same process over & over, doesn't drive the memory up. doesn't screw up the trash.desktop, which is why i dropped sed for cat.
anyways enjoy.
updated i just use 3 files now
i guess i'll star with the scripts.
trash.sh -r <-checks for trash & changes icon
trash.sh -e <- empties trash & changes icon back.
trash.sh -d <-add this to startup
trash.sh
Code:
#!/bin/bash
path=/home/user/.local/share/Trash/files
icon=/home/user/.local/share/applications/trash.desktop
while getopts "red" opt; do
case $opt in
r)
if [ "$(ls -A $path)" ]; then
echo -e '[Desktop Entry]\nType=Application\nName=Trash\nComment=Trash\nIcon=user-trash-full\nExec=nautilus /home/user/.local/share/Trash/files\nCategories=Utility;\nActions=trash;\n\n[Desktop Action trash]\nName=Empty Trash\nExec=/home/user/Documents/trash.sh -e\n' > $icon
fi
;;
e)
rm -rf /home/user/.local/share/Trash/files/* && rm -rf /home/user/.local/share/Trash/info/* && echo -e '[Desktop Entry]\nType=Application\nName=Trash\nComment=Trash\nIcon=user-trash\nExec=nautilus /home/user/.local/share/Trash/files\nCategories=Utility;\nActions=trash;\n\n[Desktop Action trash]\nName=Empty Trash\nExec=/home/user/Documents/trash.sh -e\n' > $icon
;;
d)
while sleep 60; do (/home/user/Documents/trash.sh -r &) ; done
;;
esac
done
trash.desktop <-this is the applet/application that you would add to dock
Code:
[Desktop Entry]
Type=Application
Name=Trash
Comment=Trash
Icon=user-trash
Exec=nautilus /home/user/.local/share/Trash/files
Categories=Utility;
Actions=trash;
[Desktop Action trash]
Name=Empty Trash
Exec=/home/user/Documents/trash.sh -e
Bookmarks