#!/bin/sh
DIR="$HOME/Pictures/Screenshots"
mkdir -p "$DIR"
TIMESTAMP=$(date +"%Y-%m-%d_%H-%M-%S")
FINAL_FILE="$DIR/screenshot_$TIMESTAMP.png"
TEMP_FULLSCREEN=$(mktemp /tmp/fullscreen_XXXXXX.png)
grim "$TEMP_FULLSCREEN"
TEMP_FILE=$(mktemp /tmp/screenshot_XXXXXX.png)
grim -g "$(slurp)" "$TEMP_FILE"
cp "$TEMP_FILE" "$FINAL_FILE"
wl-copy < "$TEMP_FILE"
notify-send "Screenshot" "Saved to $FINAL_FILE" -i "$TEMP_FILE"
rm "$TEMP_FILE" "$TEMP_FULLSCREEN"
