#!/bin/bash

# omarchy:summary=Remove the ChatGPT desktop app along with its configuration and caches.
# omarchy:requires-sudo=true

set -e

# The app rewrites ~/.config/Codex for as long as it runs, so a removal that
# leaves it running deletes the directory and watches it come straight back.
pkill -x ChatGPT || true

echo "Removing ChatGPT Desktop..."
omarchy-pkg-drop openai-codex-desktop

# Not ~/.cache/codex-runtimes: the Codex CLI resolves its own runtime under
# there, and it ships in a different package that survives this one.
rm -rf \
  "$HOME/.config/Codex" \
  "$HOME/.cache/Codex"

echo ""
echo "ChatGPT has been removed."
