Repository navigation
feat(macos): convert the clipboard from a keyboard shortcut and put the result back - #705
Conversation
β¦e result back A keyboard shortcut can now read the clipboard (TriggerGesture.Clipboard) before the file manager's selection: files copied in Finder, else a copied picture such as a screenshot taken with Ctrl held. The donut opens for it, and the results replace it on the clipboard, ready to paste. A picture becomes a one-item WebDrop that keeps only its result, saved where files from a browser go. - Core: IPlatformServices.SupportsClipboard / ReadClipboard / CopyToClipboard, ClipboardContent, WebDrop.SaveOnlyConverted, settings schema 55 adds Shift+Cmd+V (everywhere) on macOS unless those keys are taken. - macOS: MacOSClipboard reads file URLs, then NSFilenamesPboardType, then PNG/JPEG/HEIC/WebP/GIF/TIFF, and writes a file URL per result, a single picture also as itself. - App: ConversionService copies a clipboard job's outputs back when it finishes; Shortcuts page gets a switch per keyboard shortcut, translated in every language. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
KnifeLemon
left a comment
There was a problem hiding this comment.
Thanks, @skyhilam! Converting a screenshot on the clipboard and pasting the smaller result is a nice idea, and the clipboard handling (file URLs first, then picture data, a cancelled job leaves the clipboard alone) is careful. Two things need to change before it can go in:
- Not on by default. Shift+β+V is Paste and Match Style in Pages, Mail, Notes, Slack, Google Docs and most text fields, and the hook can't hold the keys back. With this on for everyone (new installs and the schema 55 step), every Paste and Match Style with a picture or files on the clipboard would also open the donut over the app the user is typing in. Please drop the default and the migration: the clipboard switch is there in Settings β Shortcuts for anyone who adds a shortcut and turns it on, with the keys they choose. That also frees schema 55, which another PR needs.
- No fallback to the Finder selection. When the clipboard holds neither files nor a picture, a clipboard shortcut should do nothing. Falling back to the file manager's selection means a shortcut with Active in: Everywhere converts whatever happens to be selected in a Finder window in the background, from any app, which isn't what someone pressing a "clipboard" shortcut expects. A short notice ("Nothing to convert on the clipboard") would be fine, or nothing at all.
Smaller points:
- In
CopyResults, a job that partly failed still puts its outputs on the clipboard. That's fine, but please log the failed count too, so a support log shows why fewer files were pasted than copied. - Please add a screenshot of the Shortcuts page with the new switch (light and dark), as the template asks.
New features usually start with an issue and an agreed plan here, so for the next one please open an issue first. For this one, the two points above are what's needed.
As reviewed: Shift + Cmd + V is Paste and Match Style and the hook can't hold the keys back, so the default gesture and the schema 55 migration go away (schema back to 54, freeing 55). The clipboard switch stays in Settings > Shortcuts for anyone who adds a shortcut and turns it on, with keys of their own choosing. A clipboard shortcut with neither files nor a picture on the clipboard now does nothing instead of falling back to the file manager's selection, so an Everywhere shortcut can't convert whatever is selected in a Finder window in the background. It only logs 'Nothing to convert on the clipboard', throttled. CopyResults logs the failed count next to the copied count, also when a job made nothing. The note under the switch in every language and the ARCHITECTURE.md paragraph say so. The_shortcuts_page_shows_the_clipboard_switch renders the Shortcuts page with the switch on one shortcut and off on the defaults, in light and dark (triggers-clipboard-en.png / -dark).
|
Thanks for the review β pushed
Tests: And noted β next feature starts with an issue. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Italian came to main after this branch started, so its two strings were missing. The Korean note now uses the polite ν΄μ style of the rest of ko.json and says μ΄λ―Έμ§, as the other picture strings do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The format check wants one member per line in an object initializer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Indonesian (KnifeLemon#790) came to main after this branch started. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
KnifeLemon
left a comment
There was a problem hiding this comment.
Thanks, @skyhilam! Both points are done:
- Not on by default: there's no default gesture and no migration. A clipboard shortcut exists only when someone adds one, with keys they choose.
- No fallback: with nothing convertible on the clipboard, the shortcut does nothing (a throttled log line).
The failed count is logged too, and the screenshots are in the description.
I pushed three small commits to bring the branch up to date with main:
- Italian and Indonesian: both languages reached
mainafter this branch started, so I added the two strings in each. - Korean: the note now uses the polite ν΄μ style of the rest of
ko.json. - Format check: the clipboard tests' object initializers now have one member per line.
CI is green on all platforms. Thanks for the careful clipboard handling!
What does this change?
On macOS, a keyboard shortcut can convert what's on the clipboard and put the result back on it, ready to paste. Main use: a screenshot taken with Ctrl held (Ctrl+Shift+β+4) is too large to paste into a chat. Press your shortcut, pick JPG/WebP or compress, then βV the smaller picture.
NSFilenamesPboardType), else a picture (PNG, JPEG, HEIC, WebP, GIF, TIFF). With neither on the clipboard the shortcut does nothing β it never falls back to the file manager selection. Copied files that no longer exist give nothing (not Finder's icon).WebDropwithSaveOnlyConverted: it is saved where files from a browser go (Downloads by default), and only the result is kept.ConversionServicewrites its outputs back to the clipboard: a file URL per result, and a single picture also as its own image data, so it pastes into Finder, chats and documents. A cancelled job leaves the clipboard alone. A partly failed job still copies its outputs, and the log carries the failed count next to the copied count.TriggerGesture.Clipboardworks on any keyboard shortcut. The Shortcuts page shows a switch where the platform supports it (macOS only for now:IPlatformServices.SupportsClipboard). New strings are in every language.Type of change
How was it tested?
dotnet test:ClipboardShortcutTestsin Core (3) and App (6, incl. the screenshots below),PasteboardPathsTests,LocalizationTestsand the trigger/shortcuts-page tests pass. FullFilee.Core.Tests(722): only the 12WebDownloaderTestsfail on this machine (the sandbox denies binding a local socket; unrelated to this change).Filee.app): a screenshot copied with Ctrl+Shift+β+4, then the clipboard shortcut and a smaller format, pastes the converted picture. Files copied in Finder convert and paste as the new files, and a clipboard holding only text opens nothing.Screenshots (UI changes)
Settings β Shortcuts: the clipboard switch off on the default Ctrl+β₯+Space and on for a user-added Ctrl+β₯+V (rendered by
The_shortcuts_page_shows_the_clipboard_switchinFilee.App.Tests).Checklist
src/Filee.App/Assets/i18n/*.jsonfilesTHIRD-PARTY-NOTICES.md(none added)π€ Generated with Claude Code