#!/usr/bin/env bash

# omarchy:summary=Remove Voxtype dictation and its configuration
# omarchy:requires-sudo=true

set -e

# Remove voxtype and its configurations.

if omarchy-cmd-present voxtype; then
  echo "Uninstall Voxtype to remove dictation."

  # Remove services
  systemctl --user disable --now voxtype.service 2>/dev/null || true
  systemctl --user daemon-reload

  # Remove packages and configs
  omarchy-pkg-drop voxtype
  rm -rf ~/.config/voxtype
  rm -rf ~/.local/share/voxtype
  case $("${BASH_SOURCE[0]%/*}/omarchy-compositor" || true) in
    hyprland) hyprctl reload >/dev/null ;;
    sway) omarchy-restart-sway ;;
  esac
else
  echo "Voxtype was not installed."
fi
