Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ swift run -c release pladder-cli polish-set docs/polish-set.json --model s1-mini
| Hotkey | Hold Option+Space by default, either Option; any key or chord can be recorded | A CGEvent tap (Accessibility, no Input Monitoring) matches the chord and swallows its regular key so it never reaches the target app. Sides are ignored in a chord with a regular key and kept for a modifier-only chord, so the tap and Carbon agree |
| Interrupted press | A non-chord key within 1 s of the chord press cancels the recording without transcribing | Anyone who records a lone Command key shares it with Cmd+C, Cmd+V and Cmd+Tab; the overlay waits 150 ms before showing so those never flash it. Option+Space shares no modifier with them |
| Secure Event Input | `IsSecureEventInputEnabled()` polled with the grant; sustained 3 s and a chord Carbon can register → Carbon monitor until it clears | A password field or Terminal's Secure Keyboard Entry stops taps receiving key events; modifier-only chords are unaffected and stay on the tap |
| Without Accessibility | Carbon `RegisterEventHotKey` plus clipboard-only output | A standard account cannot grant Accessibility without an admin. Carbon needs no permission but wants exactly one regular key and collapses left and right, so modifier-only chords are refused in the recorder; the transcript is left on the clipboard and the overlay says "press ⌘V". A stored chord Carbon cannot register, a lone Right Command say, is stood in for by the default Option+Space and the menu names it; the stored chord returns with the grant. `CopySymbolicHotKeys` only feeds the warning that an enabled macOS shortcut owns the recorded chord. `AppModel` polls the grant every two seconds and swaps the monitor in both directions |
| Without Accessibility (Clipboard mode) | Carbon `RegisterEventHotKey` plus clipboard-only output | A standard account cannot grant Accessibility without an admin. Carbon needs no permission but wants exactly one regular key and collapses left and right, so modifier-only chords are refused in the recorder; the transcript is left on the clipboard and the overlay says "press ⌘V". A stored chord Carbon cannot register, a lone Right Command say, is stood in for by the default Option+Space and the menu names it; the stored chord returns with the grant. `CopySymbolicHotKeys` only feeds the warning that an enabled macOS shortcut owns the recorded chord. `AppModel` polls the grant every two seconds and swaps the monitor in both directions |
| Send key | Press V (configurable) while the hotkey is held and Return is posted 50 ms after the target app reads the paste, or 400 ms after Cmd+V if nothing reads it | Sends a chat message or runs a command without a second trip to the keyboard; the Return is posted from a detached task so it stays off the release-to-paste path, and waits for the read so an app that reads late gets the text first (Chromium's early read starts the wait too, so there it is as early as a fixed delay); a Return still owed when the next paste starts goes out ahead of that paste's Cmd+V. V because the index finger of the hand holding Option+Space rests on it, so the other hand stays on the mouse; Right Option, the default before, needed both hands. A letter is fine here: it is swallowed only while the chord is held. Needs Accessibility like the paste: Carbon registers only the chord, so there Option+V reaches the app. Only for a held recording: a latched one ends on the closing press, before any send key could arm |
| Polish toggle | A Text-tab toggle (Polish section, marked Beta), off by default, no key of its own. When on, every dictation runs the usual pipeline, then Apple's on-device model (FoundationModels, `PladderRefine`) with a fixed cleanup prompt, then pastes | Self-corrections, spoken punctuation, number words and lists are beyond the deterministic processors, and the model runs on device with nothing to download. It costs one to three seconds and sits on the normal hotkey's path, which is why it is marked experimental and off: the branch is one Bool read; the session is prewarmed at key-down; transcripts under four words skip it; anything the model cannot do (Apple Intelligence off, refusal, an answer cut off at its token limit, the 8 s budget, which covers loading the model and every chunk of a long dictation) pastes the text as dictated. Logged as its own `polished release-to-paste` line |
| Learned corrections | After a paste the field is watched through Accessibility for up to 60 s; a word the user corrects that passes a token diff, a phonetic gate (Soundex or edit distance ≤ 2) and a yes/no review by the on-device model becomes one menu line, "Learned “x” → “y”? Add / Dismiss" | Nothing runs before Cmd+V is posted: the hook is in `AppModel.handle(.inserted)`, the watcher lives on its own thread and reads only the pasted range plus a margin, the review runs on a detached task and waits while a dictation is in flight, since it shares Apple's model with the polish. Only a paste that stayed in its field is watched: not a copy, not a send. Present only with Accessibility and Apple Intelligence, absent otherwise, no setting, no change to the menu bar glyph. Dismissed pairs go to `dismissed-corrections.json`, not settings, so a bug there can never cost the dictionary. Pure case changes are never proposed. Terminals and TUIs expose a screen buffer, not a field, so nothing is learned there |
| Learned corrections | After a paste the field is watched through Accessibility for up to 60 s; a word the user corrects that passes a token diff, a phonetic gate (Soundex or edit distance ≤ 2) and a yes/no review by the on-device model becomes one menu line, "Learned “x” → “y”? Add / Dismiss" | Nothing runs before Cmd+V is posted: the hook is in `AppModel.handle(.inserted)`, the watcher lives on its own thread and reads only the pasted range plus a margin, the review runs on a detached task and waits while a dictation is in flight, since it shares Apple's model with the polish. Only a paste that stayed in its field is watched: not a copy, not a send. Present only with Accessibility and Apple Intelligence, absent otherwise, no change to the menu bar glyph. One switch, "Suggest entries from my corrections" in the Dictionary tab, on by default and shown only where the learner can run: it reads other apps' fields, and revoking the grant the paste needs was the only other way to stop that. Dismissed pairs go to `dismissed-corrections.json`, not settings, so a bug there can never cost the dictionary. Pure case changes are never proposed. Terminals and TUIs expose a screen buffer, not a field, so nothing is learned there |
| Managed policy | A configuration profile's Custom Settings payload for `de.dinooo13.pladder`, read with `CFPreferences`, forced values only: `AllowedEngines` and `AllowedPolishModels` (lists, one pins the picker), `PolishDictations`, `LearnCorrections` and `UpdateChecks` (force a toggle on or off; `UpdateChecks = false` also removes Check for Updates…), `ClipboardMode` (Clipboard mode even with the grant: never asks for Accessibility, no tap, no ⌘V, no field read). Read at launch and on the two-second permission poll; applied on top of the user's settings, never written to the file. Managed controls are disabled, never hidden, with "Managed by your organisation." under the group (docs/MANAGED.md) | An organisation that must answer what the app reads and sends had nothing to point at: every choice was in a file the user owns. Managed preferences are root-owned, set by any MDM or by an admin by hand, and need no format, server or request of Pladder's own; a `defaults write` by the user is not forced, so it cannot pose as policy. Keeping the user's own settings underneath means removing the profile loses nothing. A typo is logged and ignored, and a list with no known ID is ignored whole, so a profile never leaves the app without an engine. Offline model provisioning, and the dictionary, keys and the rest, are out of it |
| Toggle key | Another recordable chord, off by default. A chord of its own latches at release however long the press; equal to the push-to-talk chord it makes that key hybrid: a tap under 400 ms latches, a longer hold stops at release. The next press of any chord, Escape or the 10 min cap ends a latched recording. The overlay is the same as for a held recording, in and out; only the menu's status line says which key stops it | Two-minute dictations should not need a key held for two minutes. Handy and VoiceInk default to hybrid on one key; here it is opt-in, because a stray tap would otherwise leave the microphone open until the cap pastes two minutes of room noise. Hold, toggle and hybrid are decided in `HotkeyGestureTracker`, a clockless value type timed by the instant each monitor stamps on its events, so both monitors behave alike and a press that waits for the microphone cannot make the next release look longer. A same-chord press within 50 ms of its release is a bounce (some Bluetooth keyboards do this mid-hold): it never acts, and the first one seen turns on a 50 ms settle before every stopping release for the rest of the run, so only a keyboard that needs it pays for it and the release path is otherwise untouched. No separate press debounce: both monitors already report alternating presses and releases. Without Accessibility the toggle chord registers with Carbon like the key; one Carbon cannot register has no stand-in, except that a hybrid chord follows the key's. With a lone modifier as a hybrid key, the Command of a later Cmd+C ends a latched recording |
| Escape | Discards a recording without transcribing and plays the stop sound; taken only while a recording is on | Never taken globally, so Escape keeps closing dialogs. On the tap `HotkeyChordSet` catches it before the chord trackers, so the interrupted-press rule never sees it, and Escape with the chord's own modifiers held still counts; Carbon registers the bare key around each recording, from the main queue so the release path never waits on it. Under Secure Event Input a modifier-only chord stays on the tap, where no key-down arrives, so Escape cannot cancel there |
| Output | Clipboard + simulated Cmd+V; the transcript is a pasteboard promise and the old clipboard comes back off the critical path, 400 ms after Cmd+V if the target app has read it by then, otherwise 200 ms after it does, or after 8 s if nothing does | Universal, fast. Waiting for the read as well as the 400 ms: an app busy when Cmd+V arrives reads late, and the timer alone handed it the old clipboard (issue #40). A read never shortens the 400 ms, because Chromium sometimes reads once before the real paste and the pasteboard serves the second read itself. The promise is served on the main thread, so a busy Pladder main thread delays the target's read; the `paste` log line records when it came. It relies on the nspasteboard.org markers: without them Universal Clipboard reads every write within ~15 ms, which would pass for the paste |
Expand Down
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Settings opens by itself the first time, with what Pladder still needs at the to
1. **Allow the microphone.** Click **Allow…** and accept the macOS prompt. That is what records your voice.
2. **Allow Accessibility.** Click **Allow…**, then **Open System Settings** in the alert; System Settings opens on the Accessibility list; switch Pladder on. That is what lets Pladder see the push-to-talk key in other apps, paste the result, and notice when you correct a word it got wrong. It does not need Input Monitoring.

On a standard (non-administrator) account, ticking that box asks for an administrator password, so ask an admin to do it once — the grant is keyed to the app's code signature and survives updates. Without it Pladder still works in a reduced form: Option+Space works the same, any combination with a regular key can be recorded in Settings (a modifier-only key such as Right Command needs Accessibility, and Option+Space stands in for it until then), and the transcript is left on the clipboard for you to paste with ⌘V. Managed Macs can pre-approve Accessibility for Pladder with an MDM Privacy Preferences Policy Control (PPPC) profile, which needs no prompt at all.
On a standard (non-administrator) account, ticking that box asks for an administrator password, so ask an admin to do it once — the grant is keyed to the app's code signature and survives updates. Without it Pladder still works in a reduced form: Option+Space works the same, any combination with a regular key can be recorded in Settings (a modifier-only key such as Right Command needs Accessibility, and Option+Space stands in for it until then), and the transcript is left on the clipboard for you to paste with ⌘V. Managed Macs can pre-approve Accessibility for Pladder with an MDM Privacy Preferences Policy Control (PPPC) profile, which needs no prompt at all, or keep Pladder off it with a profile of their own; what an organisation can fix is in [docs/MANAGED.md](docs/MANAGED.md).

Apple Intelligence, if it is on, powers learned corrections and, if you pick it, the experimental polish; nothing else needs it.
3. **Wait for the model.** The first run downloads the Parakeet Ultra CoreML models from Hugging Face into `~/Library/Application Support/FluidAudio/Models` and compiles them. Settings and the menu show the progress, the menu bar icon is dimmed meanwhile, and the push-to-talk key is disabled until the model is ready. This happens once; later launches load in well under a second.
Expand Down
Loading
Loading