Skip to content

Fix macOS clipboard restore delay#1038

Merged
gabrielste1n merged 2 commits into
OpenWhispr:mainfrom
SyntaxSawdust:codex/issue-1023-clipboard-restore-delay
Jul 3, 2026
Merged

Fix macOS clipboard restore delay#1038
gabrielste1n merged 2 commits into
OpenWhispr:mainfrom
SyntaxSawdust:codex/issue-1023-clipboard-restore-delay

Conversation

@SyntaxSawdust

@SyntaxSawdust SyntaxSawdust commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Restore the macOS clipboard after 450ms instead of 2000ms after a successful paste.
  • Add coverage for both the fast-paste path and the osascript fallback to keep the shared macOS restore delay at 450ms.

Why

Fixes #1023.

OpenWhispr 1.7.3 increased the macOS clipboard restore delay to 2000ms. That leaves the dictated text on the clipboard for longer after paste, which can cause follow-up paste behavior to use the dictated text rather than the user's previous clipboard content. This restores the shorter macOS delay while keeping the existing expected-text guard that avoids overwriting a newer user clipboard write.

Tests

  • mise x node@24 -- node --test test/helpers/clipboardRestore.test.js passed, 5/5.
  • mise x node@24 -- npm run lint passed.
  • mise x node@24 -- npm run typecheck passed.
  • mise x node@24 -- npx prettier --check src/helpers/clipboard.js test/helpers/clipboardRestore.test.js passed.
  • git diff --check upstream/main passed.
  • mise x node@24 -- npm run format:check ran but failed on existing unrelated formatting issues in helpers/audioManager.js, helpers/speakerEmbeddings.js, and helpers/textEditMonitor.js; the two changed files pass Prettier directly.

Scope / non-goals

  • Scope is limited to the macOS clipboard restore delay and focused unit coverage for the macOS paste success paths.
  • No changes to Windows or Linux clipboard timing.
  • No changes to paste behavior beyond the restore delay value.

Caveats

@SyntaxSawdust SyntaxSawdust marked this pull request as ready for review July 2, 2026 12:56
@gabrielste1n gabrielste1n self-requested a review July 3, 2026 02:51
Combines the OpenWhispr#1020 rich-format clipboard mock with this branch's
reloadable loadClipboardManager harness; all 6 tests pass.
@gabrielste1n

Copy link
Copy Markdown
Collaborator

thank you for the awesome work here @SyntaxSawdust !!

@gabrielste1n gabrielste1n merged commit 1d603bf into OpenWhispr:main Jul 3, 2026
6 checks passed
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.

[macOS] Dictation pastes twice / previous clipboard not available — 1.7.3 raised the restore delay 450ms → 2000ms

2 participants