#!/bin/bash

# archypr:summary=Edit, set, or reset About branding
# archypr:group=branding
# archypr:name=about
# archypr:args=<image|text|reset>
# archypr:examples=omarchy branding about image | omarchy branding about text | omarchy branding about reset

set -euo pipefail

case "${1:-}" in
image)
  image=$(archypr-enu-file "Logo image" "$HOME" "svg png")
  if [[ -n $image ]] && archypr-transcode-ascii "$image" ~/.config/archypr/branding/about.txt --width 54 --height 26 --mode block; then
    archypr-launch-about >/dev/null 2>&1
  fi
  ;;
text)
  archypr-launch-editor ~/.config/archypr/branding/about.txt >/dev/null 2>&1 && archypr-launch-about >/dev/null 2>&1
  ;;
reset)
  cp "$ARCHYPR_PATH/icon.txt" ~/.config/archypr/branding/about.txt && archypr-launch-about >/dev/null 2>&1
  ;;
*)
  echo "Usage: archypr-branding-about <image|text|reset>" >&2
  exit 1
  ;;
esac
