mirror of
https://github.com/tw93/Mole.git
synced 2026-02-12 22:10:14 +00:00
refactor: add feedback for fallback Trash cleanup
Improve user experience when osascript fails to empty Trash: - Count successfully cleaned items - Display cleanup confirmation message - Only show message if items were actually cleaned - Call note_activity to record the cleanup This ensures users get consistent feedback regardless of which cleanup method is used (osascript vs find fallback).
This commit is contained in:
@@ -20,9 +20,16 @@ clean_user_essentials() {
|
|||||||
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Trash · emptied, $trash_count items"
|
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Trash · emptied, $trash_count items"
|
||||||
note_activity
|
note_activity
|
||||||
else
|
else
|
||||||
|
local cleaned_count=0
|
||||||
while IFS= read -r -d '' item; do
|
while IFS= read -r -d '' item; do
|
||||||
safe_remove "$item" true || true
|
if safe_remove "$item" true; then
|
||||||
|
((cleaned_count++))
|
||||||
|
fi
|
||||||
done < <(command find "$HOME/.Trash" -mindepth 1 -maxdepth 1 -print0 2> /dev/null || true)
|
done < <(command find "$HOME/.Trash" -mindepth 1 -maxdepth 1 -print0 2> /dev/null || true)
|
||||||
|
if [[ $cleaned_count -gt 0 ]]; then
|
||||||
|
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Trash · emptied, $cleaned_count items"
|
||||||
|
note_activity
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Trash · already empty"
|
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Trash · already empty"
|
||||||
|
|||||||
Reference in New Issue
Block a user