Created
August 17, 2019 06:07
-
-
Save jotafeldmann/23b654aa7d10426b2ef387eb0775c8e2 to your computer and use it in GitHub Desktop.
Add trash icon on dock. Based on http://ubuntuhandbook.org/index.php/2018/08/add-trash-icon-dock-launcher-ubuntu-18-04/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
icon=$HOME/.local/share/applications/trash.desktop | |
trash_script_path=/home/j/workspace/libs/trash-icon-on-dock/trash.sh | |
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='$trash_script_path -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='$trash_script_path -e'\n' > $icon | |
;; | |
d) | |
while sleep 5; do ($trash_script_path -r &) ; done | |
;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment