forked from petergpt/codex-pet-limit-rings
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuninstall-limit-rings.sh
More file actions
executable file
·43 lines (38 loc) · 1.92 KB
/
Copy pathuninstall-limit-rings.sh
File metadata and controls
executable file
·43 lines (38 loc) · 1.92 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
#!/usr/bin/env bash
set -euo pipefail
DEFAULT_APP="$HOME/Applications/CodexPetLimitRings.app"
DEFAULT_OLD_APP="$HOME/Applications/CodexLimitAura.app"
APP="${CODEX_PET_LIMIT_RINGS_APP:-$DEFAULT_APP}"
BIN="$APP/Contents/MacOS/CodexPetLimitRings"
AGENT="$HOME/Library/LaunchAgents/com.codex-pet.limit-rings.plist"
OLD_APP="${CODEX_LIMIT_AURA_APP:-$DEFAULT_OLD_APP}"
OLD_BIN="$OLD_APP/Contents/MacOS/CodexLimitAura"
OLD_AGENT="$HOME/Library/LaunchAgents/com.codex-pet.limit-aura.plist"
GUI_TARGET="gui/$(id -u)"
if [[ "$APP" != "$DEFAULT_APP" ]]; then
echo "Refusing to remove unsafe app path: $APP" >&2
echo "Use the default path: $DEFAULT_APP" >&2
exit 2
fi
if [[ "$OLD_APP" != "$DEFAULT_OLD_APP" ]]; then
echo "Refusing to remove unsafe old app path: $OLD_APP" >&2
echo "Use the default old app path: $DEFAULT_OLD_APP" >&2
exit 2
fi
launchctl bootout "$GUI_TARGET" "$AGENT" >/dev/null 2>&1 || true
launchctl bootout "$GUI_TARGET" "$OLD_AGENT" >/dev/null 2>&1 || true
pkill -TERM -f "$BIN" >/dev/null 2>&1 || true
pkill -TERM -f "$OLD_BIN" >/dev/null 2>&1 || true
pkill -TERM -f "CodexPetLimitRings.app/Contents/MacOS/CodexPetLimitRings" >/dev/null 2>&1 || true
pkill -TERM -f "CodexLimitAura.app/Contents/MacOS/CodexLimitAura" >/dev/null 2>&1 || true
rm -f "$AGENT"
rm -f "$OLD_AGENT"
rm -rf "$APP"
rm -rf "$OLD_APP"
defaults delete local.codex.pet-limit-rings CodexPetLimitRings.ringsVisible >/dev/null 2>&1 || true
defaults delete local.codex.pet-limit-rings CodexPetLimitRings.barsOffsetX >/dev/null 2>&1 || true
defaults delete local.codex.pet-limit-rings CodexPetLimitRings.barsOffsetY >/dev/null 2>&1 || true
defaults delete local.codex.pet-limit-rings CodexPetLimitRings.barWidthPreset >/dev/null 2>&1 || true
defaults delete local.codex.pet-limit-rings CodexPetLimitRings.displayStyle >/dev/null 2>&1 || true
defaults delete local.codex.limit-aura CodexLimitAura.ringsVisible >/dev/null 2>&1 || true
echo "Codex Pet Limit Rings uninstalled"