diff --git a/bin/.local/bin/screenshot_all_displays.sh b/bin/.local/bin/screenshot_all_displays.sh new file mode 100755 index 0000000..ad60ef7 --- /dev/null +++ b/bin/.local/bin/screenshot_all_displays.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +SAVE_DIR="$HOME/kang8/screenshots" + +if [ ! -d "$SAVE_DIR" ]; then + mkdir --parents "$SAVE_DIR" +fi + +DISPLAY_COUNT=$(/usr/sbin/system_profiler SPDisplaysDataType -json | /usr/bin/jq '.SPDisplaysDataType[].spdisplays_ndrvs | length') + +for ((i=1; i<=DISPLAY_COUNT; i++)); do + if [ $i -eq 1 ]; then + DISPLAY_NAME="main" + else + DISPLAY_NAME="secondary_$((i-1))" + fi + + FILENAME="$(date '+%Y%m%d')_${DISPLAY_NAME}_screen.png" + + /usr/sbin/screencapture -D $i -xC "$SAVE_DIR/$FILENAME" + + echo "Screenshot saved to $SAVE_DIR/$FILENAME" +done diff --git a/crontab b/crontab index 8f88112..7d5025c 100644 --- a/crontab +++ b/crontab @@ -10,5 +10,8 @@ # Run at 11:05pm every day 5 11 * * * cd ~/Library/Rime && git pull +# Run at 15:00pm every day +0 15 * * * ~/.local/bin/screenshot_all_displays.sh && open ~/Applications/ScreenshotAllDisplays.app + # Run at 11:31pm every Tuesday 31 11 * * 2 cd ~/.config/nvim && git fetch && git rebase origin/master && ~/.local/share/bob/nvim-bin/nvim --headless "+Lazy! restore" +qa