2020-08-08 10:48:27 +02:00
|
|
|
#!/bin/bash
|
|
|
|
# This screenshot program was based on an initial command-line only version
|
|
|
|
# by the purismforum user in community/librem-5
|
|
|
|
#
|
|
|
|
# I've since expanded it to use libnotify and provide a GUI
|
|
|
|
# It requires the grim, libnotify-bin and yad packages:
|
|
|
|
# sudo apt install grim yad libnotify-bin
|
|
|
|
|
|
|
|
# Adding usage information and Icon to libnotify
|
|
|
|
|
|
|
|
function usage()
|
|
|
|
{
|
|
|
|
echo "Usage: $0, or just press the Screen Shot Icon in the app tray"
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
NOTIFY_SEND="notify-send -i applets-screenshooter"
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
--help|-h|-?)
|
|
|
|
usage
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
#Variable
|
|
|
|
|
2021-04-20 15:22:27 +02:00
|
|
|
SCREENSHOT="$(xdg-user-dir PICTURES)/$(date +%Y-%m-%d-%H%M%S).png"
|
2020-08-08 10:48:27 +02:00
|
|
|
|
|
|
|
if [ -e /usr/bin/yad ]; then
|
|
|
|
INPUT=$(yad --title Screenshot --text="Take screenshot after X seconds" --form --field=filename:SFL --field=seconds:NUM "$SCREENSHOT" "5" --focus-field=2)
|
|
|
|
echo "$INPUT"
|
|
|
|
SCREENSHOT=$(echo "$INPUT" | cut -d '|' -f1)
|
|
|
|
SECONDS=$(echo "$INPUT" | cut -d '|' -f2)
|
|
|
|
else
|
|
|
|
SECONDS=$(yad --title Screenshot --text="Take screenshot after X seconds" --entry-text=5 --entry)
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$SECONDS" -eq 0 ]; then
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
$NOTIFY_SEND -t 1000 screenshot "Taking a screenshot in $SECONDS seconds"
|
|
|
|
sleep "$SECONDS";
|
|
|
|
grim "$SCREENSHOT"
|
|
|
|
$NOTIFY_SEND screenshot "Screenshot stored at ${SCREENSHOT}"
|