1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 15:04:42 +00:00

🎨 Uninstalling and cleaning is a cleaner experience

This commit is contained in:
Tw93
2025-10-04 17:59:12 +08:00
parent a3c3975f5f
commit a830123ac4
5 changed files with 86 additions and 71 deletions

View File

@@ -37,17 +37,11 @@ select_apps_for_uninstall() {
menu_options+=("$(format_app_display "$display_name" "$size" "$last_used")")
done
echo ""
echo "🗑️ App Uninstaller"
echo ""
echo "Mole will uninstall selected apps and clean all their related files."
echo ""
echo "Found ${#apps_data[@]} apps. Select apps to remove:"
echo ""
# Use paginated menu - result will be stored in MOLE_SELECTION_RESULT
MOLE_SELECTION_RESULT=""
paginated_multi_select "Select Apps to Remove" "${menu_options[@]}"
paginated_multi_select "🗑️ Select Apps to Remove" "${menu_options[@]}"
local exit_code=$?
if [[ $exit_code -ne 0 ]]; then

View File

@@ -20,8 +20,18 @@ batch_uninstall_applications() {
local -a app_details=()
echo ""
echo -e "${BLUE}📋 Analyzing selected applications...${NC}"
# Show analyzing message with spinner
local spinner_chars="⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏"
local spinner_idx=0
local analyzed=0
for selected_app in "${selected_apps[@]}"; do
# Update spinner
local spinner_char="${spinner_chars:$((spinner_idx % 10)):1}"
((analyzed++))
echo -ne "\r🗑 ${spinner_char} Analyzing... $analyzed/${#selected_apps[@]}" >&2
((spinner_idx++))
IFS='|' read -r epoch app_path app_name bundle_id size last_used <<< "$selected_app"
# Check if app is running
@@ -47,6 +57,9 @@ batch_uninstall_applications() {
app_details+=("$app_name|$app_path|$bundle_id|$total_kb|$encoded_files")
done
# Clear spinner line
echo -ne "\r\033[K" >&2
# Format size display
if [[ $total_estimated_size -gt 1048576 ]]; then
local size_display=$(echo "$total_estimated_size" | awk '{printf "%.2fGB", $1/1024/1024}')

View File

@@ -63,8 +63,12 @@ paginated_multi_select() {
draw_menu() {
printf "\033[H\033[J" >&2 # Clear screen and move to top
# Header
printf "%s\n%s\n" "$title" "$(printf '=%.0s' $(seq 1 ${#title}))" >&2
# Header - strip emoji for length calculation
local title_clean="${title//[^[:print:]]/}"
local title_len_approx=$(( ${#title_clean} - 4 )) # Rough adjustment for emoji
[[ $title_len_approx -lt 10 ]] && title_len_approx=10
printf "${PURPLE}%s${NC}\n%s\n" "$title" "$(printf '=%.0s' $(seq 1 $title_len_approx))" >&2
# Status
local selected_count=0
@@ -92,7 +96,7 @@ paginated_multi_select() {
done
print_line ""
print_line "↑↓: Navigate | Space: Select | Enter: Confirm | Q: Exit"
print_line "${GRAY}↑/↓${NC} Navigate ${GRAY}|${NC} ${GRAY}Space${NC} Select ${GRAY}|${NC} ${GRAY}Enter${NC} Confirm ${GRAY}|${NC} ${GRAY}Q/ESC${NC} Quit"
}
# Show help screen
@@ -105,9 +109,7 @@ Help - Navigation Controls
↑ / ↓ Navigate up/down
Space Select/deselect item
Enter Confirm selection
A Select all
N Deselect all
Q Exit
Q / ESC Exit
Press any key to continue...
EOF