June 6, 2024 This is mostly a demonstration of what Windows Recall actually seems to do under the hood, and is not meant to be seriously used. Here’s the code, I have more to say after: #!/usr/bin/env bash if [ "$1" == "--daemon" ]; then MD5LAST="" while true; do # Use the current date and time for the screenshot filename FILE=~/recall/$(date +"%Y/%m/%d/%Y-%m-%d-%H:%M:%S") mkdir -p $(dirname $FILE) grim $FILE.png # Take a screenshot # If the screenshot is the same as the last one, disregard it MD5=$(md5sum $FILE.png | cut -d ' ' -f 1) if [ "$MD5" == "$MD5LAST" ]; then rm $FILE.png sleep 5 continue fi MD5LAST=$MD5 # Run tesseract on the file to extract text from the image # It always appends .txt to the filename, so the final name is $FILE.ocr.txt tesseract $FILE.png $FILE.ocr > /dev/null 2>&1 & sleep 5 done exit 0 fi # The arguments are assumed to be a ripgrep search query FILES=$(rg --files-with-matches $@ ~/recall) # Replace the filename extensions, which should be .ocr.txt, with .png FILES=${FILES//.ocr.txt/.png} mcomix $FILES When called with --daemon it will handle the screenshotting/OCR analysis, and when called with anything else it is interpreted as a ripgrep search.
No pages have linked to this URL yet.