#!/bin/bash REGION=$(slurp -f "%x %y %w %h") [ -z "$REGION" ] && exit 0 TMP=$(mktemp /tmp/ocr-XXXX.png) flameshot screen --raw > "$TMP" python3 - "$REGION" "$TMP" << 'EOF' import sys from PIL import Image x, y, w, h = map(int, sys.argv[1].split()) tmp = sys.argv[2] img = Image.open(tmp) img.crop((x, y, x+w, y+h)).save(tmp) EOF cat $TMP | wl-copy rm "$TMP"