-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty Trash custom action #21
Comments
Had same problem. Currently solved it with xbar and custom bash script. You need to provide full disk access to xbar for it to work. #!/bin/bash
#
# <xbar.title>Trash Bin Status</xbar.title>
# <xbar.version>v0.1</xbar.version>
# <xbar.author>Vulpes-Vulpeos</xbar.author>
# <xbar.desc>Plugin for xbar that shows if trash bin has anything in it and allows to empty it.</xbar.desc>
TRASH_COUNT=$(ls -1q "$HOME/.Trash/" | wc -l)
ICON_TRASH_EMPTY="iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAAXNSR0IArs4c6QAAAHhlWElmTU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAIdpAAQAAAABAAAATgAAAAAAAACQAAAAAQAAAJAAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAACCgAwAEAAAAAQAAACAAAAAAfgvaUgAAAAlwSFlzAAAWJQAAFiUBSVIk8AAAAWtJREFUSA3tVDGKg0AUDcsi2ChEsPMAgmCthZY2Qg5gbuBVbBWsPYG9RO2Txk602JxBK6PsfnYgGHecmWwWFkJ+Mcz/7/33Zv6Imw0tFEXJsmwYhs9ZQApFgGjdDHgURTPlm20YhgwCNErXdaBqWdacaNs2FAGaF+n73W53Op0ul8vNOZkTmNvxeHRdF++k6zqzFIWoaRrGI45j6DscDoIgYGCGkiiKZVmCCP5t+r4HTFVVBqlVCpwdRPBvAwCEJEmr3QzAdrtFOhhunucIe3wtigJjYBhG0zSPq7dta5omxgCVkMEqTASwvW/Elj8An97g4zuukyKnVxpps3ioR1Jk8/RvQJomG/YaEXVOrxH9/4jeyUc4n89zAjmdM1f3i5/PKg8HYHuXX9E0TdDL8zxOgVTjOA5g8CCRAKuqCkh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cMlPPgsXQj5PAYvF8mIBeg/gNIEiHCtuO2BjR1T8kYt8usBoNIKcXC5H1cCER4pUHP5eUJEPFx4p3oMqhDCfz+VyOYjSe1CtViE/lUo5HA6RSMTughWFd+HbfcANCGO1WsE1fjgcfgI/t0/oCcCx4QAAAABJRU5ErkJggg=="
if [ "$1" = 'empty_trash' ]
then
osascript -e '
tell application "Finder"
empty the trash
end tell'
exit
fi
if [ "$1" = 'open_trash_folder' ]
then
open "$HOME/.Trash/"
exit
fi
if [[ "${TRASH_COUNT}" -eq 0 ]]
then
echo "| templateImage=${ICON_TRASH_EMPTY}";
else
echo "| templateImage=${ICON_TRASH_FULL}";
fi
echo '---'
echo "${TRASH_COUNT} item(s) | bash='$0' param1=open_trash_folder terminal=false"
echo "Empty Bin | bash='$0' param1=empty_trash terminal=false refresh=true"
exit |
xbar is crinj |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I see this as a way to get rid of the evil dock (Ok, not evil but I don't like it). If I could empty the trash (like once a month most of the time I use rm {blah}), then its one less dependancy I have on the dock.
The text was updated successfully, but these errors were encountered: