Add image clipboard sync support#2
Merged
offbyonebit merged 2 commits intomainfrom Apr 19, 2026
Merged
Conversation
Syncs images (PNG) via a new clipboard.png sidecar file alongside the existing clipboard.txt. The OUT loop tries image first, falls back to text. The IN watcher dispatches to separate text/image handlers based on which file changed. Encryption works for both types: _encrypt/_decrypt now operate on bytes directly, with callers handling text encoding. Platform clipboard access: - Windows: ctypes + CF_DIB (no extra deps) - macOS: AppKit NSPasteboard via pyobjc - Linux: xclip or wl-paste/wl-copy subprocesses https://claude.ai/code/session_01HaCGbmbaF3rBff9fxyP7TS
- Stub _read_clipboard_image / _write_clipboard_image in the text-only test fixtures. The new image-priority logic in _out_tick calls _read_clipboard_image() before the text path, and the previous fakes only mocked text access. On a Mac with a real PNG sitting on the system clipboard, every text test in test_mac_windows_sync.py and test_cross_os_sync.py would pick that image up instead of the fake text payload and time out waiting for propagation. - Declare pyobjc-core and pyobjc-framework-Cocoa as explicit macOS deps in requirements.txt. They previously arrived transitively via pystray's rumps backend, but the new NSPasteboard image writer imports AppKit and Foundation directly, so the dependency is now first-party. - Add --hidden-import AppKit and --hidden-import Foundation to the PyInstaller build on macOS. Both modules are imported lazily inside _write_image_to_system_clipboard, which PyInstaller's static analysis sometimes misses; without the hints, the frozen bundle would silently fail at image paste time. - Minor ruff-format reflow picked up on paths the branch touched. Verified end-to-end on Mac: putting a PNG on the system clipboard triggers 'OUT: N bytes image written' from both the source run and the PyInstaller .app, and clipboard.png appears in the sync folder encrypted (CSENC-prefixed) when a passphrase is set.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
clipboard.pngsidecar file alongside the existingclipboard.txt_encrypt/_decryptto operate on rawbytesso both text and image payloads are encrypted the same wayTest plan
pytest tests/— all 28 tests should passhttps://claude.ai/code/session_01HaCGbmbaF3rBff9fxyP7TS