41 lines
918 B
Bash
Executable file
41 lines
918 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
# pancakes' wayland screenshot script
|
|
# takes screenshots, saves them, copies to clipboard, and notifies you
|
|
# depends on grim, libnotify, slurp, and wl-copy
|
|
|
|
set -e
|
|
|
|
if [ -z $2 ]; then
|
|
echo "Usage: $0 path full|display|region [notify=true|false]"
|
|
exit
|
|
fi
|
|
|
|
FILENAME="$1/$(date +%F_%H-%M-%S)_$2.png"
|
|
|
|
case $2 in
|
|
"full")
|
|
# capture full screen screenshot with cursor
|
|
grim -c $FILENAME
|
|
;;
|
|
"display")
|
|
# capture display screenshot with cursor
|
|
grim -c -g "$(slurp -o)" $FILENAME
|
|
;;
|
|
"region")
|
|
# capture screenshot of slurped region
|
|
grim -g "$(slurp)" $FILENAME
|
|
;;
|
|
*)
|
|
echo "Mode must be either full, display, or region"
|
|
exit
|
|
;;
|
|
esac
|
|
|
|
NOTIFY=$3
|
|
if [ ${NOTIFY:=false} = true ]; then
|
|
notify-send "Screenshot captured" "$FILENAME"
|
|
fi
|
|
|
|
# copy screenshot to clipboard
|
|
wl-copy < $FILENAME
|