this post was submitted on 12 Jun 2024
91 points (96.9% liked)

Linux

5188 readers
164 users here now

A community for everything relating to the linux operating system

Also check out !linux_memes@programming.dev

Original icon base courtesy of lewing@isc.tamu.edu and The GIMP

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] redbr64@lemmy.world 11 points 4 months ago

This nice little one liner bash script, assigned to a shortcut Meta +Shift + O. It opens the flameshot GUI, let's you select an area of text in your screen and click Ok. It OCRs the screenshot and puts it into the clipboard. It checks for whether you're using Wayland or X11 to use the appropriate clipboard tool. Beyond the more typical text in an image scenario, it's a convenient way to copy non-selectable text in error popups. Not my original idea, copied the concept from a suggestion in a GitHub comment thread and adapted it.

exec &> /dev/null [ "$XDG_SESSION_TYPE" = "wayland" ] && (flameshot gui --raw | tesseract stdin stdout | wl-copy) || (flameshot gui --raw | tesseract stdin stdout | xclip -in -selection clipboard)