Skip to content

Instantly share code, notes, and snippets.

@corbindavenport
Last active September 22, 2022 13:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save corbindavenport/11943745e6c672f57f91265a2113d60b to your computer and use it in GitHub Desktop.
Save corbindavenport/11943745e6c672f57f91265a2113d60b to your computer and use it in GitHub Desktop.
Bash script for automatically capturing screenshots
# How to use:
# ./screenshot-tool.sh [export directory] [seconds between screenshots]
# Example: ./screenshot-tool.sh ~/Pictures 5
# Install scrot if it's not already installed
if ! [ -x "$(command -v scrot)" ]; then
sudo apt install -y scrot
fi
# Set directory to parameter $1
cd "$1"
echo "Capturing a screenshot every $2 seconds."
echo "press CTRL-C to stop."
# Take a screenshot every $2 seconds of the current window
for (( ; ; ))
do
scrot '%Y-%m-%d_$wx$h.jpg' -q 70 -u
sleep "$2"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment