1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-14 23:25:08 +00:00

Optimize the count

This commit is contained in:
Tw93
2025-11-22 16:11:41 +08:00
parent 804c4c2161
commit ba058acc05
2 changed files with 7 additions and 12 deletions

View File

@@ -272,21 +272,16 @@ execute_optimization() {
echo -e "${BLUE}${ICON_ARROW}${NC} Clearing recent items lists..." echo -e "${BLUE}${ICON_ARROW}${NC} Clearing recent items lists..."
local shared_dir="$HOME/Library/Application Support/com.apple.sharedfilelist" local shared_dir="$HOME/Library/Application Support/com.apple.sharedfilelist"
if [[ -d "$shared_dir" ]]; then if [[ -d "$shared_dir" ]]; then
# Count files first, then delete (safer than -print -delete) # Delete shared file lists
local removed
removed=$(find "$shared_dir" -name "*.sfl2" -type f 2> /dev/null | wc -l | tr -d ' ')
find "$shared_dir" -name "*.sfl2" -type f -delete 2> /dev/null || true find "$shared_dir" -name "*.sfl2" -type f -delete 2> /dev/null || true
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Reset $removed shared file lists" echo -e " ${GREEN}${ICON_SUCCESS}${NC} Shared file lists cleared"
else
echo -e " ${GRAY}-${NC} Recent item caches already clean"
fi fi
# Clear recent items preferences
rm -f "$HOME/Library/Preferences/com.apple.recentitems.plist" 2> /dev/null || true rm -f "$HOME/Library/Preferences/com.apple.recentitems.plist" 2> /dev/null || true
# Check if key exists before trying to delete defaults delete NSGlobalDomain NSRecentDocumentsLimit 2> /dev/null || true
if defaults read NSGlobalDomain NSRecentDocumentsLimit > /dev/null 2>&1; then
defaults delete NSGlobalDomain NSRecentDocumentsLimit 2> /dev/null || true echo -e " ${GREEN}${ICON_SUCCESS}${NC} Recent items cleared"
fi
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Finder/Apple menu recent items cleared"
;; ;;
radio_refresh) radio_refresh)

2
mole
View File

@@ -22,7 +22,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/lib/common.sh" source "$SCRIPT_DIR/lib/common.sh"
# Version info # Version info
VERSION="1.10.4" VERSION="1.10.5"
MOLE_TAGLINE="can dig deep to clean your Mac." MOLE_TAGLINE="can dig deep to clean your Mac."
# Check if Touch ID is already configured # Check if Touch ID is already configured