Files
dotfiles/dot_local/scripts/executable_gss-screenshot.sh
T

27 lines
590 B
Bash

#!/usr/bin/env bash
set -o errexit
set -o pipefail
set -o nounset
SCREENSHOTS_DIR="${XDG_PICTURES_DIR:-$(xdg-user-dir PICTURES)}/Screenshots"
mkdir -p "${SCREENSHOTS_DIR}"
MODE="${1:-region}"
case "${MODE}" in
region)
still -p -c 'grim -g "$(slurp -d)" -t ppm -'
;;
monitor-focused)
still -p -c 'grim -t ppm -o "$(niri msg --json focused-output | jq --raw-output .name)" -'
;;
monitor-all)
still -p -c 'grim -t ppm -'
;;
*)
echo "'${MODE}' is not a supported, aborting!" >&2
exit 1
;;
esac | satty --filename - --output-filename "${SCREENSHOTS_DIR}/screenshot-%+.png"