Skip to content

Keep dictations out of clipboard history apps - #312

Open
rupokghosh wants to merge 1 commit into
AssemblyAI:mainfrom
rupokghosh:fix/clipboard-transient-marker
Open

rupokghosh wants to merge 1 commit into
AssemblyAI:mainfrom
rupokghosh:fix/clipboard-transient-marker

Conversation

@rupokghosh

Copy link
Copy Markdown
Contributor

What changed

  • the transcript blurt puts on the clipboard for its cmd-v, and the restore of the previous clipboard after it, now carry org.nspasteboard.TransientType
  • clipboard history apps (raycast, maccy, alfred) skip items with that marker, so dictations no longer show up in clipboard history, and the old clipboard is no longer re-added on top after every dictation
  • the fallback that leaves the transcript on the clipboard for a paste by hand stays unmarked, since those words are meant to be kept

Why

every dictation was saved to clipboard history as if the user had copied it, credited to whatever app was in front, and the restore added a duplicate of the old clipboard each time. that also covered anything dictated into a password field.

How it was tested

  • new tests in SystemClipboardTests against the real pasteboard: the paste write and both restore paths are marked, the hand-paste fallback is not. they fail on main and pass with this change
  • swift test passes (1242 tests), swift format lint --strict is clean
  • drove KeyInjector.insert on the real pasteboard with only the cmd-v stubbed, 3 pastes on main and 3 with this change, with raycast clipboard history running. raycast recorded the 3 from main plus a repeat of the old clipboard, and nothing from this change
  • built the full app (debug, ad-hoc signed) with this change. i did not run scripts/check.sh locally, so CI is the source of truth for the rest

A paste writes the transcript to the pasteboard, posts cmd-v and restores
the previous contents 400 ms later. Neither write carried a marker, so
clipboard managers (Raycast, Maccy, Alfred) recorded every dictation as a
copy, credited to whatever app was in front, and recorded the restored
contents again on top of the history.

Both writes now carry org.nspasteboard.TransientType, which those apps
skip. The degraded path that leaves the transcript on the clipboard for
a paste by hand stays unmarked, since those words are meant to be kept.
Checked against Raycast: an unmarked 400 ms write is recorded, a
TransientType one is not.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant