mirror of
https://github.com/tw93/Mole.git
synced 2026-03-22 20:15:07 +00:00
fix(uninstall): sync LaunchServices refresh for Spotlight update, remove background hint message, close #490
This commit is contained in:
@@ -735,26 +735,15 @@ batch_uninstall_applications() {
|
|||||||
print_summary_block "$title" "${summary_details[@]}"
|
print_summary_block "$title" "${summary_details[@]}"
|
||||||
printf '\n'
|
printf '\n'
|
||||||
|
|
||||||
# Run non-critical post-cleanup tasks asynchronously so the next prompt appears immediately.
|
if [[ $success_count -gt 0 && ${#success_items[@]} -gt 0 ]]; then
|
||||||
# These tasks are best-effort and should not block interactive flow.
|
# Refresh LaunchServices synchronously so Spotlight removes the app immediately.
|
||||||
if [[ $brew_apps_removed -gt 0 || ($success_count -gt 0 && ${#success_items[@]} -gt 0) ]]; then
|
|
||||||
local -a post_success_items=("${success_items[@]}")
|
|
||||||
local post_brew_apps_removed="$brew_apps_removed"
|
|
||||||
|
|
||||||
if [[ -t 1 ]]; then
|
|
||||||
echo -e "${GRAY}${ICON_LIST}${NC} Finalizing uninstall cleanup in background..."
|
|
||||||
fi
|
|
||||||
|
|
||||||
(
|
|
||||||
if [[ "$post_brew_apps_removed" -gt 0 ]]; then
|
|
||||||
HOMEBREW_NO_ENV_HINTS=1 brew autoremove > /dev/null 2>&1 || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ${#post_success_items[@]} -gt 0 ]]; then
|
|
||||||
remove_apps_from_dock "${post_success_items[@]}" 2> /dev/null || true
|
|
||||||
refresh_launch_services_after_uninstall 2> /dev/null || true
|
refresh_launch_services_after_uninstall 2> /dev/null || true
|
||||||
|
remove_apps_from_dock "${success_items[@]}" 2> /dev/null || true
|
||||||
fi
|
fi
|
||||||
) > /dev/null 2>&1 &
|
|
||||||
|
# brew autoremove can be slow — run in background so the prompt returns quickly.
|
||||||
|
if [[ $brew_apps_removed -gt 0 ]]; then
|
||||||
|
(HOMEBREW_NO_ENV_HINTS=1 brew autoremove > /dev/null 2>&1 || true) &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_cleanup_sudo_keepalive
|
_cleanup_sudo_keepalive
|
||||||
|
|||||||
Reference in New Issue
Block a user