1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-06 20:05:37 +00:00

feat: add system maintenance cleanup module

- Add broken preferences detection using plutil -lint validation
- Add broken login items cleanup (LaunchAgents pointing to missing files)
- Add universal binary slimming (opt-in via MOLE_SLIM_BINARIES=true)
- Protect Spotify cache if >500MB (likely contains offline music)
- Warn when browsers are running before cache cleanup
- All cleanup stats properly counted in final summary
This commit is contained in:
Yuze Pan
2025-11-30 10:30:22 +08:00
parent 1a6f1cf393
commit b79797faf8
4 changed files with 355 additions and 1 deletions

29
lib/clean_user_data.sh Normal file → Executable file
View File

@@ -100,7 +100,36 @@ clean_sandboxed_app_caches() {
}
# Clean browser caches (Safari, Chrome, Edge, Firefox, etc.)
# Warns if browsers are running (some cache files may be locked)
clean_browsers() {
# Check for running browsers and warn user
local running_browsers=""
local -a browser_checks=(
"Safari"
"Google Chrome"
"Firefox"
"Microsoft Edge"
"Brave Browser"
"Arc"
"Opera"
"Vivaldi"
)
for browser in "${browser_checks[@]}"; do
if pgrep -x "$browser" > /dev/null 2>&1; then
if [[ -z "$running_browsers" ]]; then
running_browsers="$browser"
else
running_browsers="$running_browsers, $browser"
fi
fi
done
if [[ -n "$running_browsers" ]]; then
echo -e " ${YELLOW}${ICON_WARNING}${NC} Running: $running_browsers (some files may be locked)"
note_activity
fi
safe_clean ~/Library/Caches/com.apple.Safari/* "Safari cache"
# Chrome/Chromium