#!/bin/bash

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

set -euo pipefail

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