#!/usr/bin/env bash
set -euo pipefail

LABEL="${AURORA_LAUNCHD_LABEL:-com.daarion.aurora}"
DOMAIN="gui/$(id -u)"
PLIST_PATH="${HOME}/Library/LaunchAgents/${LABEL}.plist"

launchctl bootout "${DOMAIN}/${LABEL}" >/dev/null 2>&1 || true
launchctl disable "${DOMAIN}/${LABEL}" >/dev/null 2>&1 || true

if [ -f "${PLIST_PATH}" ]; then
  rm -f "${PLIST_PATH}"
fi

echo "[aurora-launchd] removed: ${PLIST_PATH}"
