2017-10-16 14:38:02 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
TRASH_DIRECTORY="${BLOCK_INSTANCE}"
|
|
|
|
|
|
|
|
if [[ "${TRASH_DIRECTORY}" = "" ]]; then
|
2017-12-07 22:20:42 -06:00
|
|
|
TRASH_DIRECTORY="${XDG_DATA_HOME:-${HOME}/.local/share}/Trash"
|
2017-10-16 14:38:02 -05:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Left click
|
|
|
|
if [[ "${BLOCK_BUTTON}" -eq 1 ]]; then
|
2017-12-07 22:20:42 -06:00
|
|
|
xdg-open "${TRASH_DIRECTORY}/files"
|
|
|
|
# Right click
|
2017-10-16 14:38:02 -05:00
|
|
|
elif [[ "${BLOCK_BUTTON}" -eq 3 ]]; then
|
2017-12-07 22:20:42 -06:00
|
|
|
# Delete all files permanently (unlink them)
|
|
|
|
rm -r "${TRASH_DIRECTORY}/files"
|
|
|
|
rm -r "${TRASH_DIRECTORY}/info"
|
|
|
|
# Create new directory
|
|
|
|
mkdir "${TRASH_DIRECTORY}/files"
|
|
|
|
mkdir "${TRASH_DIRECTORY}/info"
|
2017-10-16 14:38:02 -05:00
|
|
|
fi
|
|
|
|
|
|
|
|
TRASH_COUNT=$(ls -U -1 "${TRASH_DIRECTORY}/files" | wc -l)
|
|
|
|
|
|
|
|
URGENT_VALUE=30
|
|
|
|
|
|
|
|
echo "${TRASH_COUNT}"
|
|
|
|
echo "${TRASH_COUNT}"
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
if [[ "${TRASH_COUNT}" -ge "${URGENT_VALUE}" ]]; then
|
2017-12-07 22:20:42 -06:00
|
|
|
exit 31
|
2017-10-16 14:38:02 -05:00
|
|
|
fi
|