Skip to content

fix(windows): keep temporary pastes out of clipboard history - #1768

Open
badigit wants to merge 1 commit into
cjpais:mainfrom
badigit:codex/clipboard-pr-clean
Open

fix(windows): keep temporary pastes out of clipboard history#1768
badigit wants to merge 1 commit into
cjpais:mainfrom
badigit:codex/clipboard-pr-clean

Conversation

@badigit

@badigit badigit commented Jul 22, 2026

Copy link
Copy Markdown

Before Submitting This PR

Please confirm you have done the following:

If this is a feature or change that was previously closed/rejected:

  • I have explained in the description below why this should be reconsidered
  • I have gathered community feedback (link to discussion below)

Human Written Description

On W11 , the "don't modify clipboard" option was still filling my Win+V history with duplicates and empty entries. I use clipboard history all the time, so this was really annoying. This fix keeps pasting fast without changing or polluting the clipboard history.

Related Issues/Discussions

Related: #1356

This issue was closed because clipboard-based paste was assumed to have no way to avoid Windows clipboard-history entries. Windows exposes registered clipboard formats specifically for excluding a clipboard transaction from monitoring, history, and cloud sync, which makes a Windows-specific fix possible without changing the paste mechanism.

Community Feedback

The original report and reproduction are in #1356. No separate discussion has been opened because this is a bug fix for the existing Don't Modify Clipboard behavior, not a new feature.

Testing

  • Built the Windows x64 production application, MSI, and NSIS installer in the existing GitHub Actions workflow: https://github.com/badigit/Handy/actions/runs/29920434836
  • The workflow's Windows runtime audit installed both packages, verified bundled runtime DLLs, and launched handy.exe --list-devices successfully.
  • Manually tested the unsigned Windows build on Windows 11 with clipboard history enabled. Clipboard-mode transcriptions remained fast, the previous clipboard content was restored, and repeated pastes did not add transcription or blank entries to Win+V history.
  • Added unit coverage for CF_DIB byte layout, invalid RGBA lengths, and empty image dimensions.
  • An independent read-only review found no remaining blocking issues after removing test-only version/workflow changes and extending clipboard-open retries to approximately 475 ms.

Screenshots/Videos (if applicable)

Not included. The behavior is observable directly in the Windows Win+V clipboard-history panel; reproduction steps are documented in #1356.

AI Assistance

  • No AI was used in this PR
  • AI was used (please describe below)

If AI was used:

  • Tools used: OpenAI Codex
  • How extensively: Codex investigated the Windows clipboard behavior, implemented most of the patch and tests, prepared the cloud build, and performed an independent read-only review. The contributor manually tested the resulting Windows build.

@badigit
badigit marked this pull request as ready for review July 22, 2026 14:04
@cjpais

cjpais commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Thanks for this I'll take a look we should try to avoid polluting the clipboard unless necessary

To be fair the setting is intended to restore your clipboard to whatever state it was originally in (best effort). Anyhow will take a look

@badigit
badigit force-pushed the codex/clipboard-pr-clean branch from 9ca6b0b to b36f818 Compare August 4, 2026 10:54
@gabethehuman

Copy link
Copy Markdown

I would love to see it merged as a heavy win+v user, that would be so useful.

@badigit

badigit commented Aug 8, 2026

Copy link
Copy Markdown
Author

Quick update: I tested the newer reliable paste from #1812/current main on Windows 11.

It works better than before, but for me it still doesn’t fully solve the Win+V history issue. The approach in this PR works more consistently in my case and keeps temporary pastes out of clipboard history.

So I think this PR may still be useful even with #1812 merged.

@cjpais

cjpais commented Aug 9, 2026

Copy link
Copy Markdown
Owner

yep this one will also be merged! just need more time to review and things

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.

3 participants