Last active
September 1, 2025 12:19
-
-
Save dewomser/31d62caf9523462724961ab95ef29d9e to your computer and use it in GitHub Desktop.
From Screenshot to OCR to Klipper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Desktop Entry] | |
| Comment[de_DE]= | |
| Comment= | |
| Exec=/home/foo/bin/OCR2Clipboard.sh | |
| GenericName[de_DE]=Bild ausschneiden und Text nach Zwischenablage | |
| GenericName=Bild ausschneiden und text nach Zwischenablage | |
| Icon=accessories-screenshot-tool | |
| MimeType= | |
| Name[de_DE]=OCR2Clipboard | |
| Name=OCR2 Clipboard | |
| Path= | |
| StartupNotify=true | |
| Terminal=false | |
| TerminalOptions=\s--noclose | |
| Type=Application | |
| X-DBUS-ServiceName= | |
| X-DBUS-StartupType= | |
| X-KDE-SubstituteUID=false | |
| X-KDE-Username= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/bash | |
| # KDE,spectacle and tesseract is required | |
| # spectacle After scanarea is open, press Enter. | |
| # works with Wayland | |
| # Look at your clpboard for scanned text | |
| tmpfile_png=$(mktemp /tmp/lolo.XXXXXXXXX --suffix .png) | |
| spectacle -r -n -b -d 5000 -o "$tmpfile_png" | |
| text="$(tesseract $tmpfile_png - -l deu)" | |
| dbus-send --type=method_call --dest=org.kde.klipper /klipper org.kde.klipper.klipper.setClipboardContents string:"$text" | |
| rm "$tmpfile_png" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment