#!/usr/bin/env bash
# @vicinae.schemaVersion 1
# @vicinae.title Pick Color
# @vicinae.mode silent
# @vicinae.icon ../../icons/hicolor/scalable/apps/panama-settings.svg
# @vicinae.description Pick a color from the screen; the hex lands on the clipboard.
# @vicinae.keywords ["color", "colour", "picker", "eyedropper", "hex"]

# -a autocopies to the clipboard; the notification is the receipt. hyprpicker
# exits 1 on Escape, which is a choice, not a failure.
if ! command -v hyprpicker >/dev/null 2>&1; then
  notify-send "Pick Color" "hyprpicker is not installed" 2>/dev/null || true
  exit 1
fi
color="$(hyprpicker -a)" || exit 0
[[ -n "$color" ]] && notify-send --icon=color-select-symbolic "Copied $color" 2>/dev/null || true
