#!/usr/bin/env bash # Illuscape uninstaller set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "$SCRIPT_DIR/scripts/detect_platform.sh" echo "╔══════════════════════════════╗" echo "║ Illuscape Uninstaller ║" echo "╚══════════════════════════════╝" echo "" echo "→ Inkscape config: $INKSCAPE_CONFIG" # ── Find backup ─────────────────────────────────────────────────────────────── BACKUP=$(ls -1d "${INKSCAPE_CONFIG}".bak-illuscape-* 2>/dev/null | sort | tail -1 || true) if [[ -z "$BACKUP" ]]; then echo "⚠ No Illuscape backup found at ${INKSCAPE_CONFIG}.bak-illuscape-*" echo " Cannot restore original preferences.xml automatically." echo " Removing only Illuscape-installed files." else echo "→ Restoring preferences.xml from: $BACKUP" cp "$BACKUP/preferences.xml" "$INKSCAPE_CONFIG/preferences.xml" 2>/dev/null || true fi # ── Remove Illuscape-installed files ───────────────────────────────────────── remove_files() { # Keys rm -f "$INKSCAPE_CONFIG/keys/illustrator-cc.xml" rm -f "$INKSCAPE_CONFIG/keys/illustrator-cs6.xml" # Palettes rm -f "$INKSCAPE_CONFIG/palettes/Illustrator-Defaults.gpl" rm -f "$INKSCAPE_CONFIG/palettes/Illustrator-Grays.gpl" rm -f "$INKSCAPE_CONFIG/palettes/Illustrator-Earth.gpl" # Templates rm -f "$INKSCAPE_CONFIG/templates/Letter.svg" rm -f "$INKSCAPE_CONFIG/templates/A4.svg" rm -f "$INKSCAPE_CONFIG/templates/Web-1920x1080.svg" rm -f "$INKSCAPE_CONFIG/templates/Web-1280x720.svg" rm -f "$INKSCAPE_CONFIG/templates/Print-CMYK-Letter.svg" rm -f "$INKSCAPE_CONFIG/templates/Print-CMYK-A4.svg" # Symbols rm -f "$INKSCAPE_CONFIG/symbols/illuscape-common.svg" # Splash rm -f "$INKSCAPE_CONFIG/splashscreens/illuscape-splash.png" echo "→ Illuscape config files removed" } remove_desktop() { [[ "$INKSCAPE_INSTALL_METHOD" != "native" ]] && return 0 rm -f "$HOME/.local/share/applications/org.inkscape.Inkscape.desktop" for size in 16 32 48 64 128 256 512; do rm -f "$HOME/.local/share/icons/hicolor/${size}x${size}/apps/illuscape.png" done update-desktop-database "$HOME/.local/share/applications" 2>/dev/null || true echo "→ Desktop launcher removed" } remove_files remove_desktop echo "" echo "✓ Illuscape uninstalled." echo "" echo " Note: Your Inkscape preferences may have changed since Illuscape was" echo " installed. If anything looks wrong, review:" echo " $INKSCAPE_CONFIG/preferences.xml" echo ""