This program:
- Creates a random filename
- Takes a screenshot with
scrot
and stores it in /tmp/OCR - Gets its mimetype (ancient artifact)
- encodes to
base64
- OCR’s via API
- Copies result to clipboard with
xclip
- Writes result to file in /tmp/OCR
- Sends a notification with
notify
-send
Requires the following tools:
pwgen
scrot
base64
xclip
notify-send
You need to s/YOUR_API_KEY_HERE/[ API key from https://openrouter.ai/settings/keys ]/
Run with uv --cache-dir=/tmp/uv run aiocr.py
Bind it to a shortcut. Your cursor will change, this is scrot
’s doing. Select an area and it will (hopefully) be transcribed.
- The prompt is geared towards Org-Mode users. Modify it to get output in MarkDown (or whatever you prefer).
- It uses a free model and it sometimes drops requests. Change to a better / paid model to increase reliability.