Skip to content

Instantly share code, notes, and snippets.

@CodeLongAndProsper90
Last active July 10, 2020 21:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CodeLongAndProsper90/e4bfcf5b7d5cb4556a0177fe30e4264f to your computer and use it in GitHub Desktop.
Save CodeLongAndProsper90/e4bfcf5b7d5cb4556a0177fe30e4264f to your computer and use it in GitHub Desktop.
!/bin/bash
if ! test -d ~/Screenshots
then
mkdir ~/Screenshots
fi
if ! command -v scrot &> /dev/null
then
echo "scrot not installed or missing from \$PATH. Cannot continue."
echo "Stop."
exit 1
fi
if [ "$1" == "instant" ] || [ "$1" == "i" ]
then
scrot ~/Screenshots/`date +%s`.png
elif [ "$1" == "gimp" ] || [ "$1" == "g" ]
then
if ! command -v gimp &> /dev/null
then
echo "gimp not installed or missing from \$PATH. Cannot continue."
echo "Stop."
exit 1
fi
scrot ~/Screenshots/`date +%s`.png
gimp ~/Screenshots/`date +%s`.png
rm -f ~/Screenshots/`date +%s`.png
elif [ "$1" == "delay" ] || [ "$1" == "d" ]
then
scrot ~/Screenshots/`date +%s`.png --delay "$2"
else
echo "[i]nstant: Take a screenshot"
echo "[g]IMP: Open in the GIMP"
echo "[d]elay: Delay $2 seconds"
echo ""
echo "Exit status 0: Finshed"
echo "Exit status 1: Missing dependences"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment