-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.sh
More file actions
executable file
·61 lines (48 loc) · 2.18 KB
/
uninstall.sh
File metadata and controls
executable file
·61 lines (48 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# ╔══════════════════════════════════════════════╗
# ║ shellraiser uninstaller ║
# ╚══════════════════════════════════════════════╝
set -e
SR_DIR="$(cd "$(dirname "$0")" && pwd)"
BACKUP_DIR="$SR_DIR/.backups"
ZSHRC="$HOME/.zshrc"
G=$'\033[38;2;51;255;0m'
Y=$'\033[38;2;255;225;0m'
R=$'\033[38;2;255;0;68m'
D=$'\033[38;2;68;68;68m'
X=$'\033[0m'
step() { echo " ${G}▸${X} $1"; }
ok() { echo " ${G} ✓${X} ${D}$1${X}"; }
# Detect current theme
CURRENT_THEME=$(grep 'SHELLRAISER_THEME=' "$ZSHRC" 2>/dev/null | head -1 | sed 's/.*SHELLRAISER_THEME="//' | sed 's/".*//' || echo "unknown")
echo ""
echo " ${Y}UNINSTALLING SHELLRAISER${X} ${D}(theme: ${CURRENT_THEME})${X}"
echo ""
# ── Remove shellraiser block from .zshrc ──
step "Removing theme from .zshrc..."
source "$SR_DIR/lib/zshrc.sh"
if shellraiser_remove_block "$ZSHRC"; then
ok "Removed shellraiser config"
else
ok "No shellraiser config found in .zshrc"
fi
# ── Restore Terminal.app profile ──
step "Restoring Terminal.app profile..."
# Find most recent backup
LATEST_BACKUP=$(ls -td "$BACKUP_DIR"/*/ 2>/dev/null | head -1)
if [[ -n "$LATEST_BACKUP" && -f "$LATEST_BACKUP/terminal-profile-name.txt" ]]; then
ORIGINAL_PROFILE=$(cat "$LATEST_BACKUP/terminal-profile-name.txt")
defaults write com.apple.Terminal "Default Window Settings" -string "$ORIGINAL_PROFILE"
defaults write com.apple.Terminal "Startup Window Settings" -string "$ORIGINAL_PROFILE"
ok "Restored default profile: $ORIGINAL_PROFILE"
else
defaults write com.apple.Terminal "Default Window Settings" -string "Basic"
defaults write com.apple.Terminal "Startup Window Settings" -string "Basic"
ok "Reset to Basic profile"
fi
PROFILE_NAME=$(echo "$CURRENT_THEME" | tr '[:lower:]' '[:upper:]')
echo ""
echo " ${D}Uninstalled. Close and reopen Terminal to see changes.${X}"
echo " ${D}The '${PROFILE_NAME}' profile still exists in Terminal > Settings${X}"
echo " ${D}if you want to delete it manually.${X}"
echo ""