Coder Social home page Coder Social logo

rhettbull / textinator Goto Github PK

View Code? Open in Web Editor NEW
174.0 8.0 9.0 3.52 MB

Simple MacOS StatusBar / Menu Bar app to automatically detect text in screenshots

License: MIT License

Python 98.50% Shell 1.50%
macos ocr osx menubar menubar-app menubarapp screenshot utility

textinator's People

Contributors

allcontributors[bot] avatar bwagner avatar rhettbull avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

textinator's Issues

Add ability to override Dropbox's "Share screenshots and screen recordings" link sharing

Textinator doesn't OCR the text when Dropbox's "Share screenshots and screen recordings using Dropbox" setting is toggled on. Instead of getting a copy of the text found in the screenshot, I receive a copy of the Dropbox share url to the screenshot

Would it be possible to add the ability to override this feature?

Just curious because it takes many clicks to toggle Dropbox's feature on/off.

Thank you!

Screenshot 2024-04-28 at 8 08 05 AM

Some of Textinator's menu entries don't follow the official Apple Guideline

Some of Textinator's menu entries don't follow the official Apple Guideline: "Use title-style capitalization if you need to use more than one word in the menu title.":

  • Text detection confidence threshold -> - Text Detection Confidence Threshold
  • Text recognition language -> - Text Recognition Language
  • Always detect English -> - Always Detect English
  • Detect text in images on clipboard -> - Detect Text in Images on Clipboard
  • Pause text detection -> - Pause Text Detection
  • Detect QR codes -> - Detect QR Codes
  • Keep linebreaks -> - Keep Linebreaks
  • Append to clipboard -> - Append to Clipboard
  • Clear clipboard -> - Clear Clipboard
  • Confirm clipboard changes -> - Confirm Clipboard Changes
  • Start Textinator on login -> - Start Textinator on Login

Feature: Pause app

Sometimes you don't want your clipboard affected when taking a screenshot containing text. It would be nice to be able to pause Textinator. Even better: Pause it for a period of time (or, if possible, for the next screenshot).
And/or add a configuration option whether to display a confirm dialog whenever Textinator is about to affect your clipboard.

Unable to build from source

Following the instructions from Developer Notes with a few additions:

  • Python 3.10.13
  • OSX version 14.1.1 Sonoma on Apple M1
git clone https://github.com/RhetTbull/textinator.git
cd textinator
python -m venv ~/venv/textinator
source ~/venv/textinator/bin/activate
python3 -m pip install --no-cache-dir -r requirements.txt
python3 -m pip install --no-cache-dir -r dev_requirements.txt

The second pip install issues errors:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
pyobjc-framework-coreml 10.0 requires pyobjc-core>=10.0, but you have pyobjc-core 8.5.1 which is incompatible.
pyobjc-framework-coreml 10.0 requires pyobjc-framework-Cocoa>=10.0, but you have pyobjc-framework-cocoa 8.5.1 which is incompatible.
pyobjc-framework-vision 10.0 requires pyobjc-core>=10.0, but you have pyobjc-core 8.5.1 which is incompatible.
pyobjc-framework-vision 10.0 requires pyobjc-framework-Cocoa>=10.0, but you have pyobjc-framework-cocoa 8.5.1 which is incompatible.
pyobjc-framework-vision 10.0 requires pyobjc-framework-Quartz>=10.0, but you have pyobjc-framework-quartz 8.5.1 which is incompatible.

I don't even understand where the pyobjc-core 8.5.1 comes from, since the requirements.txt asks for pyobjc-core>=9.2. I was deliberately using option --no-cache-dir for the pip install to make sure that no cached version of the packages would be installed.

Trying to solve it:

pip-compile requirements.txt dev_requirements.txt  -o -

gives me:

  ERROR: Cannot install -r dev_requirements.txt (line 2), -r requirements.txt (line 1) and pyobjc-core>=9.2 because these package versions have conflicting dependencies.

running build.sh in spite of this still generates a DMG file, but the contained application aborts with "Launch error".
Towards the end of the build-run there's:

...

Modules not found (unconditional imports):
 * _abcoll (rumps.packages.ordereddict)
 * _io._WindowsConsoleIO (importlib._bootstrap_external)
 * _overlapped (asyncio.windows_events)
 * com (com.sun.jna)
 * com.jna (com.sun)
 * com.sun (com.sun.jna.platform)
 * dummy_thread (rumps.packages.ordereddict)
 * jinja2 (pkg_resources._vendor.pyparsing.diagram)
 * pyparsing (pkg_resources._vendor.pyparsing.diagram)
 * railroad (pkg_resources._vendor.pyparsing.diagram)
 * thread (rumps.packages.ordereddict)
 * win32com (win32com)
 * win32com.shell (win32com.shell)
 * win32com.shellcon (win32com.shell)

Modules not found (conditional imports):
 * _manylinux (pkg_resources._vendor.packaging._manylinux)
 * com (pkg_resources._vendor.appdirs)
 * com.sun.jna (pkg_resources._vendor.appdirs)
 * com.sun.jna.platform (pkg_resources._vendor.appdirs)
 * pep517 (importlib.metadata)
 * win32com (pkg_resources._vendor.appdirs)
 * win32com.shell (pkg_resources._vendor.appdirs)
 
 ...

Running the generated application from the command line with /Applications/Textinator.app/Contents/MacOS/Textinator gives me:

ModuleNotFoundError: No module named 'rumps'

How do I set up my development environment for this to compile? I'd love to contribute to the project.

Add option to copy last detected text to clipboard

          > How about this, would it be possible to keep a clipboard cache that stores the text of the previous OCR job? I

That's not a bad idea. You could do this with a clipboard management app but it should be easy to add a "Copy last text detection to clipboard" feature and maybe an option to pop up a window with the last detection.

Originally posted by @RhetTbull in #31 (comment)

Feature: Screenshot in clipboard

When you use Ctrl-Cmd-Shift-4 to copy a section of the screen, it is not saved as a screenshot, but is merely kept in the Clipboard. Often I don't need to have a screenshot as a file when capturing it just for the sake of text recognition. It would be useful to have Textinator also react to this constellation and perform text recognition of a picture in the clipboard.

Proposition: Make Textinator Into a Generalized Extensible Clipboard Manipulation Tool

I often wish for additional features to Textinator's existing functionality, like:

  • titlecase the contents of the clipboard, e.g. "the meaning of life" -> "The Meaning of Life"
  • when the clipboard contains a filename, replace invalid/unwanted characters, e.g.:
    "~/Documents/der frühling [Vol.2].pdf" -> "~/Documents/der_fruehling_Vol_2.pdf"
  • When copying text out of an Apple "Books" document, that app feels compelled to remind me that the text is copyrighted by appending a litany to what I had chosen to copy. In the case of program code that is particularly disruptive. Textinator would offer to revert the clipboard contents to the originally intended. Example: Highlight and copy some code out of Mark Lutz' "Programming Python, 4th edition", p. 972:
import time
gmt = time.gmtime(time.time())

What ends up in your clipboard instead:

import time
gmt = time.gmtime(time.time())”

Excerpt From
Programming Python
Mark Lutz
This material may be protected by copyright.

So, Textinator would become like a hub for clipboard manipulations of which its existing OCR-functionality is but a plugin.

Here's an example script I currently have in my bin-directory, which would become a plugin in this Textinator-hub:

#!/usr/bin/env python

from titlecase import titlecase
import pyperclip

pyperclip.copy(titlecase(pyperclip.paste()))

Add help

Add a help menu that uses Help Viewer to show help page.

test suite currently has 8 passing and 10 failing tests

The testsuite currently seems to be failing:

================================================================= short test summary info ==================================================================
FAILED tests/test_textinator.py::test_screenshot_no_notification - AssertionError: assert 'notification:' not in '2023-11-17T... happened.\n'
FAILED tests/test_textinator.py::test_screenshot_qrcode - AssertionError: assert '' == 'https://gith...ll/textinator'
FAILED tests/test_textinator.py::test_screenshot_qrcode_with_text - AssertionError: assert 'https://github.com/RhetTbull/textinator' in 'SCAN ME'
FAILED tests/test_textinator.py::test_screenshot_qrcode_with_text_no_detect - AssertionError: assert 'https://git...l/textinator' not in 'SCAN ME\nht...l...
FAILED tests/test_textinator.py::test_pause - AssertionError: assert 'Paused\nHello World' == 'Paused'
FAILED tests/test_textinator.py::test_confidence - AssertionError: assert '' == 'Hello World'
FAILED tests/test_textinator.py::test_clipboard_basic - AssertionError: assert '' == 'Hello World'
FAILED tests/test_textinator.py::test_confirm_clipboard_changes_yes - assert False
FAILED tests/test_textinator.py::test_confirm_clipboard_changes_no - assert "'confirmation': 1" in "2023-11-17T16:11:19.032612 - search: an update happen...
FAILED tests/test_textinator.py::test_about - assert False
========================================================= 10 failed, 8 passed in 132.69s (0:02:12) =========================================================

Update rumps to 0.4.0

Rumps 0.4.0 now supports python 3.10
Update Textinator to use 0.4.0 and update docs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.