Skip to content

Instantly share code, notes, and snippets.

@chaorace
Created July 12, 2023 14:27
Show Gist options
  • Save chaorace/68286b07a5056a098f9e725cf92aeb93 to your computer and use it in GitHub Desktop.
Save chaorace/68286b07a5056a098f9e725cf92aeb93 to your computer and use it in GitHub Desktop.
Easy Linux OCR Kanji Lookup Oneliners
# These oneliners summon a mouse-based region picker, OCRs the selected area, then sends the text to goldendict. I use these in my linux desktop keybind config files
# NOTE: Goldendict needs to be configured for your target language! For Japanese, see https://jd4gd.com/index.html
# NOTE: Available languages for gazou are "jpn", "chi_sim", and "chi_trad"
# Wayland version
# Requirements: grim (wayland screenshotter), slurp (wayland region picker), gazou (OCR), goldendict (dictionary)
# Arch/Paru requirements install: paru -S community/grim community/slurp aur/gazou-git aur/goldendict
grim -g "$(slurp)" - | gazou -l jpn | xargs -I{} goldendict "{}"
# X11 version
# Requirements: scrot (x11 screenshotter w/ region picker), gazou (OCR), goldendict (dictionary)
# Arch/Paru requirements install: paru -S community/scrot aur/gazou-git aur/goldendict
scrot -s - | gazou -l jpn | xargs -I{} goldendict "{}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment