Architecture & InternalsSelection Engine & Clipboard Safety
Selection Engine & Clipboard Safety
3-tier selection extraction cascade, AX element reading, and zero-pollution clipboard snapshots.
Selection Retrieval Cascade
OpenClip routes selection extraction based on application type:
Direct Accessibility (AX) Extraction
To prevent UI hangs, AX inspection runs on a concurrent background queue (com.openclip.ax-inspect) gated by an AXSlot actor (at most 1 blocking AX worker) and raced against a 0.5-second timeout watchdog (Constants.axReadTimeout).
Zero-Pollution Clipboard Snapshot & Restore
When fallback synthetic copy is needed:
- Verbatim Multi-Type Snapshot: Clones all pasteboard representations across all data types.
- 2ms Polling Loop: Listens for
pasteboard.changeCountchanges with a 0.25s timeout (0.4s for Safari). - Immediate Restoration: Replaces original clipboard items immediately upon reading the text.
- Transient Marker Tags: Attaches
org.nspasteboard.TransientTypeandorg.nspasteboard.AutoGeneratedTypetags to prevent 3rd-party clipboard managers from logging intermediate copy cycles.