22 lines
555 B
Bash
Executable File
22 lines
555 B
Bash
Executable File
#!/bin/bash
|
|
###
|
|
### ~/.config/hypr/scripts/screenshot/screenshot_area.sh
|
|
###
|
|
|
|
time=$(date +%Y-%m-%d-%H%M%S)
|
|
dir="$(xdg-user-dir PICTURES)/Screenshots"
|
|
file="Screenshot_${time}.png"
|
|
|
|
mkdir -p "$dir"
|
|
|
|
# Select a region with slurp; exit silently if cancelled (ESC/right-click)
|
|
geometry=$(slurp) || exit 1
|
|
|
|
# Capture region, save it and copy to clipboard
|
|
grim -g "$geometry" "$dir/$file" || exit 1
|
|
wl-copy -t image/png < "$dir/$file"
|
|
|
|
if command -v notify-send >/dev/null 2>&1; then
|
|
notify-send -a Screenshot -i camera-photo "Screenshot saved" "$file"
|
|
fi
|