helm/bin/scrcap
2020-01-03 23:00:27 -05:00

17 lines
445 B
Bash
Executable file

#!/usr/bin/env bash
# A script that takes a screenshot (prompts you for what region/window to
# capture) and stores it in the clipboard.
tmp=$(mktemp)
cleanup() { rm -f "$tmp"; }
trap cleanup EXIT
# Delay for long enough that we can refocus the targeted window
if maim --delay=${1:-0.6} -us >"$tmp"; then
xclip -selection clipboard -t image/png "$tmp" &&
notify-send "Screenshot saved"
else
notify-send -u low "Aborted screenshot"
fi