#!/bin/sh # Region screenshot -> ~/Pictures + clipboard. # # This file used to contain a single broken line (`slur`, and it was not # executable): the typo meant `slurp` never ran, and nothing referenced it # anyway -- the $mod+shift+p keybind in config.d/keybinds has its own inline # pipeline. Fixed and kept as the shared implementation so the behaviour is # identical wherever it gets wired up. # # Usage: screen-capture.sh [region|output|full] (default: region) # (no "window" mode: slurp offers region, `-o` output and `-p` point selection # only -- it cannot pick a window) set -u outdir="${XDG_PICTURES_DIR:-$HOME/Pictures}" mkdir -p "$outdir" file="$outdir/$(date +%F-%H%M%S).png" case "${1:-region}" in region) geom=$(slurp) || exit 1 # Esc cancels [ -n "$geom" ] || exit 1 grim -g "$geom" "$file" ;; output) geom=$(slurp -o -f '%g') || exit 1 # pick a monitor [ -n "$geom" ] || exit 1 grim -g "$geom" "$file" ;; full) grim "$file" ;; *) echo "usage: $(basename "$0") [region|output|full]" >&2; exit 2 ;; esac [ -s "$file" ] || { echo "capture failed" >&2; exit 1; } wl-copy < "$file" notify-send -i "$file" "Screenshot saved" "$file"