helm/bin/scrcap
Henrik Lissner a75c64d04a
Rewrite to use flakes
This puts a hard dependency on 20.09, but that's to be expected.
2020-10-11 01:31:33 -04:00

17 lines
496 B
Plaintext
Executable file

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