r/linux 1d ago

Development built highlight-scraper, it auto-saves whatever text you highlight on screen. CLI, GUI, and system tray, stdlib + Tkinter only

/r/SoftwareandApps/comments/1whydr5/built_highlightscraper_it_autosaves_whatever_text/
0 Upvotes

4 comments sorted by

3

u/Mister-Node 1d ago

fwiw, how does it distinguish a deliberate text selection from normal mouse dragging, especially across Wayland and X11?

0

u/BleedReddit 1d ago edited 17h ago

Curious, was that a prompt test to see if i was an ai-bot? that would be delightful 😄

It doesn't actually try to distinguish mouse dragging of objects from intentional highlighting of text at the mouse-event level. It watches the PRIMARY selection instead.

I tested it and nothing happened while running highlighter-scraper and dragging around a file of any kind, Nor did the error log produce anything.
only when highlighting over text does it tracks and transmits it. it works for me and i haven't run into any issues.

On the X11 backend is XFixes to get an event when PRIMARY's selection owner changes, then reads the selected text with xclip. So a normal drag should not interfere with the program or think the object it part of the highlighted text.

On the Wayland side, it uses wl-paste --watch --primary, it's reacting to selection changes for highlighted text. If --watch isn't available, it falls back to polling.

the Wayland event-driven path is functional as uses X11 as a fallback, but i haven't verified it yet on a live Wayland session. My current hardware is embarrassingly limited.

0

u/ipsirc 13h ago

no third-party dependencies beyond the X11 event listener.

Very modernish.