screen-capture.sh was a single non-executable line containing a `slur` typo, so it never ran and nothing referenced it; rewritten as a working region capture to ~/Pictures plus clipboard. xdg-desktop-portal/portals.conf pins the wlr backend for sway, and swaync is pulled in via graphical-session.target.wants so the portal's Requisite=graphical-session.target is satisfied (the reason screen sharing previously never started).
34 lines
1.2 KiB
Bash
Executable File
34 lines
1.2 KiB
Bash
Executable File
#!/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"
|