2019-08-06 10:56:54 -07:00
|
|
|
#!/usr/bin/env nix-shell
|
2019-08-26 10:15:12 -07:00
|
|
|
#! nix-shell -i bash -p maim slop
|
2019-08-06 10:56:54 -07:00
|
|
|
|
|
|
|
# A script that takes a screenshot (prompts you for what region/window to
|
|
|
|
# capture) and stores it in the clipboard.
|
|
|
|
|
|
|
|
tmp=$(mktemp)
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
|
|
|
rm -f "$tmp"
|