#!/usr/bin/env bash
 
entries="Screen Window Area Area+Edit"
 
selected=$(printf '%s\n' "$entries" | tr ' ' '\n' | wofi --style="$HOME"/.config/wofi/macc_style.css --conf="$HOME"/.config/wofi/config.screenshot | awk '{print tolower($1)}')

if [ "$1" == "clipboard" ]; then
  case $selected in
    screen)
      hyprshot --notif-timeout 2000 -m output --clipboard-only;;
    window)
      hyprshot --notif-timeout 2000 -m window --clipboard-only;;
    area)
      hyprshot --notif-timeout 2000 -m region --clipboard-only;;
    area+edit)
      hyprshot --notif-timeout 2000 -m region --clipboard-only
      sleep 0.1
      flatpak run com.github.maoschanz.drawing -c
      ;;
  esac
else 
  case $selected in
    screen)
      hyprshot --notif-timeout 2000 -m output -o ~/Pictures/;;
    window)
      hyprshot --notif-timeout 2000 -m window -o ~/Pictures/;;
    area)
      hyprshot --notif-timeout 2000 -m region -o ~/Pictures/;;
    area+edit)
      hyprshot --notif-timeout 2000 -m region --clipboard-only
      sleep 0.1
      flatpak run com.github.maoschanz.drawing -c
      ;;
  esac
fi
