Last active
September 22, 2022 13:35
-
-
Save corbindavenport/11943745e6c672f57f91265a2113d60b to your computer and use it in GitHub Desktop.
Bash script for automatically capturing screenshots
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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