Skip to content

Instantly share code, notes, and snippets.

@roma-guru
Last active October 5, 2022 13:57
Show Gist options
  • Save roma-guru/a7d9bd00a3fbbc4ef9c849364e5452e2 to your computer and use it in GitHub Desktop.
Save roma-guru/a7d9bd00a3fbbc4ef9c849364e5452e2 to your computer and use it in GitHub Desktop.
Simple screen recorder
#!/bin/zsh
screenlogs_dir=$HOME/Documents/ScreenLogs/$(date "+%Y-%m-%d")
[ ! -d $screenlogs_dir ] && mkdir -p $screenlogs_dir
screen_file=$screenlogs_dir/$(date "+%H-%M").png
/usr/sbin/screencapture -xm $screen_file
# Add to crontab:
# crontab -e
# */30 * * * * /Users/roma/Documents/ScreenLogs/capture.sh
@roma-guru
Copy link
Author

Simple screen recorder for mac that I use to track time spent during the day.
It just make screenshots regularly and save them with timestamps, so you can review them nightly.

To run it use cron:

  1. place capture.sh to ~/Documents/ScreenLogs;
  2. give to /usr/sbin/cron disk access permission + screen capture permission in System Preferences->Security and Privacy;
  3. run crontab -e;
  4. insert */15 9-19 * * * ~/Documents/ScreenLogs/capture.sh;

Screens saved every 15 min in worktime to ~/Documents/ScreenLogs, each day in separate folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment