#!/bin/bash

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

set -euo pipefail

case "${1:-}" in
image)
  image=$(blob-file-select --title "Pick PNG or SVG for About" --extensions "png svg")
  if blob-transcode-ascii "$image" ~/.config/blob/branding/about.txt --width 54 --height 26; then
    blob-launch-about >/dev/null 2>&1
  fi
  ;;
text)
  blob-launch-editor ~/.config/blob/branding/about.txt >/dev/null 2>&1 && blob-launch-about >/dev/null 2>&1
  ;;
reset)
  cp "$BLOB_PATH/icon.txt" ~/.config/blob/branding/about.txt && blob-launch-about >/dev/null 2>&1
  ;;
*)
  echo "Usage: blob-branding-about <image|text|reset>" >&2
  exit 1
  ;;
esac
