#!/bin/env bash

# shot - Take a screenshot and upload it
# Depends on: share

filename=$(date "+%F_%T").png
flameshot_cmd="flatpak run org.flameshot.Flameshot"

if command -v $flameshot_cmd &> /dev/null; then
    $flameshot_cmd gui -r | ~/.local/bin/share -f $filename - | grep "Hotlink:" | cut -d ' ' -f2 | xclip -selection c \
        && notify-send "Shot" "Screenshot URL copied to clipboard"
else
    echo "No supported screenshot program found"
    exit 1
fi