#!/bin/bash
set -euo pipefail

# 常见桌面压缩 GUI 工具
CHECK_APPS=(
    file-roller       # GNOME 归档管理器
    ark               # KDE
    engrampa          # MATE 压缩工具
    xarchiver         # Xfce/LXDE
    peazip
    360yasuo
    com.360.yasuo
)

INSTALLED=0

for app in "${CHECK_APPS[@]}"; do
    if command -v "$app" >/dev/null 2>&1 || \
       dpkg -l 2>/dev/null | grep -qw "$app" || \
       [ -d "/opt/360zip" ] || \
       [ -f "/usr/share/applications/360zip.desktop" ]; then
        INSTALLED=1
        break
    fi
done

if [ "$INSTALLED" -eq 0 ]; then
    echo "检测到电脑缺少解压软件，是否从软件商店安装360压缩？[是/否]"
else
    echo "已安装桌面压缩工具，无需安装。"
fi
