Commit Graph
101 Commits
Author SHA1 Message Date
Dax 90cca52748 windows: don't paste into the desktop or taskbar, keep the dictation on the clipboard (#2016)
* windows: don't paste into the desktop or taskbar, keep the dictation on the clipboard (#2009)

* windows: keep the shell fallback plain and unmarked, and accept a copy in practice (#2009)
2026-11-19 19:10:26 -05:00
Kit Langton ec5e7282ca fix(labs): Switch model with app matches a picked app under its Finder name too (#2018)
The app picker saves the name Finder shows for the bundle's file, but Switch model with app looked modes up by the running app's own name only, so a mode picked as "Rex Beta" (Rex Beta.app runs as Rex) never switched the model. The frontmost read used by the switcher now shares capture_frontmost's name read and passes Finder's name alongside, and the mode lookup accepts either, as Modes and YOLO mode already do. Windows keeps matching its process name.
2026-11-19 15:17:36 -08:00
Dax 643563378d windows: re-arm a silenced keyboard hook and heal a lost shortcut release (#2006)
* windows: re-arm a silenced keyboard hook and heal a lost shortcut release

A Toggle dictation could keep recording for 50 minutes while every
shortcut press and Escape did nothing and nothing was logged: Windows had
stopped calling the low-level keyboard hook and the lost chord release
left the capture reading as held.

Add a 1 s watchdog on the hook thread that re-installs the keyboard hook
when session input keeps arriving but neither hook has seen an event for
3 s, and on the same tick releases a keyless chord whose keys read up as
its lost release would. Log the escape cancel, an ignored escape while
recording, and each watchdog re-arm.

* windows: keep hook-side logging off the hook path, re-arm both hooks with back-off

* windows: gate the release heal on keyboard silence and back off on keyboard events only
2026-11-19 16:41:53 -05:00
Kit Langton 998131ef82 fix(modes): match a picked app under its Finder name too (#2001)
The app picker saves the name Finder shows for the bundle's file, but the frontmost read reports the running app's own name, so a picked app whose file is named differently (Rex Beta.app runs as Rex, Visual Studio Code.app as Code) never activated its Mode and Labs › YOLO mode never pressed Return in it. The macOS frontmost read now also keeps Finder's name for the bundle when it differs, and application matching accepts either, so existing saved lists start working without re-picking.
2026-11-19 09:34:33 -08:00
Kit Langton a33f207f96 fix(labs): YOLO mode pastes and sends through Copy dictation only (#2000)
With Copy dictation only on, a dictation went to the clipboard unpasted, so YOLO mode never pressed Return and looked broken. In YOLO mode's apps (or every app with none chosen) the dictation now pastes and sends; elsewhere Copy dictation only still just copies, and a rescued microphone-loss dictation on macOS is still only copied.
2026-11-19 09:22:59 -08:00
Dax e4d85b44aa windows: join back-to-back dictations with a space (#1980)
* windows: join back-to-back dictations with a space

move the input-activity revision, continuation join and its tests into a
platform-neutral continuation module. windows now invalidates it on real
keys and clicks from the low-level hooks and on foreground-window changes,
and the paster joins dictation and paste last the way macos does.

* windows: end continuations on real input and skip hex's own trigger

injected input from other tools and the auxiliary mouse buttons end a paste
continuation as on macOS, while Hex's own synthetic events and a dictation
trigger that Labs › Share shortcut lets through do not. A standalone macOS
paste clears the continuation only where dev did: at the start of typing, or
after the clipboard is preserved and checked.

* windows: a bare trigger key press ends the paste continuation

Labs › Share shortcut lets the dictation trigger's key reach the app in
front, and the hook treated every event for that key as hex's own. A
plain Space while Ctrl+Space is bound then kept the continuation, so the
next dictation joined with a space for no reason. Mark the press as the
shortcut's only once it claims the capture, and drive the hook's own
state machine in a test.
2026-11-18 19:28:07 -05:00
Dax 7460e7aa50 windows: let altgr type its character over a ctrl+alt shortcut (#1964) (#1967) 2026-11-18 05:04:51 -05:00
Dax 536cffef8d windows: let right alt alone fire on altgr layouts (#1950) (#1951)
AltGr layouts send a synthesized Left Ctrl (scan code 0x21D) before the
Right Alt, and GetAsyncKeyState reports it as a real Ctrl, so a modifier-only
Right Alt shortcut never matched there.

The listener's hook and the settings recorder's own hook leave that Ctrl out
of chord state and matching, and both feed one shared atomic, because the
recorder's hook runs even when Hex isn't listening. The recorder reads the
key state once per poll: a chord with a key keeps the Ctrl (AltGr+Q is
Ctrl+Alt+Q, never Alt+Q), and only a modifier-only chord drops it.

Modifier-only matching accepts either the view without AltGr's Ctrl or the
same read with it counted, so the `control+option` an AltGr-layout recording
made before this still fires, while a real Left Ctrl plus Right Alt doesn't
match Right Alt alone.

Left Ctrl bits are settled before each hook event, keyboard and mouse, from
GetAsyncKeyState, so a release that landed on another desktop heals on the
next event. AltGr's Ctrl-up keeps its bit until that settle, so a recorder
poll in the gap cannot count that Ctrl as a real one, and a real Left Ctrl
pressed right after still clears it and sets REAL.
2026-11-18 00:13:47 -05:00
Dax dc9401189f Fix #1947: hex restart waits for the old Hex to exit before relaunching (#1949)
* Fix #1947: hex restart waits for the old Hex to exit before relaunching

* hex restart: watch the old process from before the quit, and keep a forwarder's wait

- `ExitWatch` takes the Windows SYNCHRONIZE handle while the old Hex still
  runs, before the restart is sent, and closes it on drop; Unix keeps the pid
  and polls liveness. `wait(timeout)` covers both, and `hex restart` waits on
  it instead of on the local API, whose discovery file is retracted earlier in
  the drain.
- `hex start` no longer treats an exited child as failure by itself: a Linux
  `hex app` forwards to the systemd unit (or a 2.3.1 install's handoff) and
  exits once the forward is accepted, so a successful forwarder keeps the
  ordinary 20 s wait. Any other exit gets a 2 s grace for a successor to
  answer, then fails with a message that fits why the child exited.
- docs: the pid-wait test is Unix only, and the Windows path is compiled in
  CI without one.

* the restart watch's test is Linux only

macOS never takes an ExitWatch (it relaunches itself), so the test must not
name one there; Windows waits on a process handle and is compiled only.

* start: treat a 2.3.1 install's handoff as a start in progress

A Windows `hex app` from a legacy layout starts the managed copy in the
background and exits, so that exit is not a failure. `legacy::will_take_over`
is the predicate `take_over` already uses, checked here before the spawn, so a
successful child keeps the ordinary 20 s wait instead of only the 2 s grace.

The comments now say where a handoff actually exits: Windows, since Linux's
legacy relaunch execs and never returns; Linux's forwarder is the systemd
unit.

* restart's watch: refuse pid 0, clamp the Windows timeout, and test it everywhere

- `ExitWatch::new` refuses pid 0 (on Unix `kill(0, …)` means the process
  group), and the Windows wait clamps to `u32::MAX - 1` so a huge timeout can
  never become INFINITE.
- The wait's test moves out of the Unix-only module and runs on Linux and
  Windows, with the child halves taken from this same test binary by `--exact`
  and an environment variable, as `desktop::process_exit` does. Check Windows
  runs it under nextest.
- The docs now name `control/cli/launch.rs` and say where the discovery file,
  Linux's service lock, and Windows' instance event really go relative to the
  process, and the wait test's Linux-and-Windows reach.
- `will_take_over` is Windows-only and asked before the spawn, which is the
  launch it describes.

* comments: spell out when the old Hex's locks and files go, per OS

On Linux the host worker's drop of the service Server joins before
LocalApi::shutdown removes the discovery file, so the lock goes first; on
Windows the file goes first, then the tray, and the instance event last, at
process exit. The test comment also names the parent's wait_with_output as the
reap.

* restart's watch: loop the Windows wait on a clock, and gate the child on a pipe

`WaitForSingleObject` timeouts are tick-quantized and can report a timeout
before the requested interval has passed, which made the test's elapsed-time
assertion flaky. The Windows branch now loops against an `Instant` deadline,
asks once more with no timeout when the clock says the time is up, and returns
false on `WAIT_FAILED`.

The test's child no longer sleeps: it blocks on one byte of stdin, which the
parent holds open while it takes the watch and closes to end it, so neither
case races the clock. It also asserts pid 0 is refused.
2026-11-17 23:14:08 -05:00
Dax 9a79a25475 make the labs card copy plain (#1929)
* make the labs card copy plain

Rewrite the Labs card titles and lines in words a regular user understands:
YOLO mode says the message sends itself, Live text and Failure notices name
the small recording indicator, Vocabulary help says which speech models it
affects, and the key-side cards name Option, Command, Shift, and Control.
Audit every other card, updating the CLI descriptions, all nine translated
languages, the website lab catalog, the feature docs, and the render goldens.

* fix labs copy review findings

Restore the ISO qualifier on the section-key card, spell out that
double-tap and hold-through shortcuts contain no letter or number key,
cover all Global mode stages in the API text card, and name the print
command in the print-start copy. Restore the developer API card titles,
fix the Annotate capture wording, and retranslate the affected strings.
Remove every replaced translation key and stale lab-name reference.

* fix second labs copy review

Update the live typing test and YOLO goldens. Add a Windows variant of the
hold-through-keys copy naming Ctrl, Alt, Shift, and the Windows key. Remove
the last unused rewrite-by-voice translation key, keep Annotate untranslated
in the replay title, and clean the remaining old lab-name comments.

* use the Polish Annotate pane name in its replay title

Polish calls the Annotate pane Adnotacje, so the Annotate last 15 seconds
title says Ostatnie 15 sekund w Adnotacjach again. Other languages keep
Annotate because their pane name is Annotate.
2026-11-16 22:32:02 -05:00
Kit Langton 0cfc7a1f86 fix(dictation): send short replies in YOLO mode (t1596) (#1903)
* test(labs): render the enabled YOLO card in both appearances (t1596)

* fix(dictation): send short replies in YOLO mode (t1596)

* test(labs): pin YOLO mode without the duration picker (t1596)
2026-11-16 16:00:14 -08:00
Dax a87adee594 dictation: keep the live stream inside the clip and stop calling a feedback tone a lost opening (#1911)
* dictation: keep the stream inside the clip, and only call a lost opening one

Two regressions in 3.4.0 made most hotkey dictations give up their live
stream and re-transcribe the whole clip, so paste latency grew with the
clip's length.

The release tail (3.4.0) waits for the stop tone plus speech after it before
it decides the tail, keeping capture running up to release + 428 + 160 ms
with the default Classic sound. Every chunk ingested meanwhile was fed to the
live stream, while `Recording::finish` trims the clip to release + its tail:
the stream heard 388 ms of audio the clip dropped, past the engine's 250 ms
overfeed tolerance, so it refused the stream. A finish now caps live feeding
at the release plus `POST_RELEASE_TAIL` (`DictationCapture::limit_stream_to`),
the base tail that is always kept; a grown tail, and audio captured while the
tail decides, arrive through `finish_stream`'s remainder of the finished
clip. macOS, Linux, and Windows all cap at the release they finish on.
`MAX_OVERFED_SAMPLES` is unchanged.

The opening-coverage check (3.4.0) summed every speech frame anywhere before
the first token, so Hex's own start tone and the double tap's click at the
clip's head added up past 300 ms and forced a whole-clip run on a stream that
had lost nothing. `PauseCap` now counts only the contiguous run of speech that
runs into the text's start (syllable gaps of up to 40 ms bridged, ending
within the 400 ms slack the first token may be emitted late by) and names the
run's span in the reason. A sound that sits on its own, seconds earlier, is
never a lost opening.

Checks: `a_long_release_tail_never_feeds_the_stream_past_the_clip` (fails by
4_480 samples without the cap), `an_isolated_burst_before_a_late_first_token_does_not_discard_the_stream`,
`a_split_burst_that_reaches_the_threshold_is_not_a_lost_opening`, and
`speech_running_into_the_texts_start_is_still_a_lost_opening`.

* dictation: ignore the capture's own sounds, not a whole run, before the text

The opening-coverage check counted every speech frame anywhere before the
first token, so Hex's own audio at the clip's head (the pre-roll through the
press, which can hold a retracted first tone and an earlier dictation's stop
tone, then the start tone) added up past 300 ms and forced a whole-clip run on
a stream that had lost nothing. Counting only one contiguous run was worse:
a lost opening followed by a pause longer than the check's 400 ms slack (2 s of
speech, a 1 s pause, text at 3.5 s) was accepted, which is the case the check
exists for, and requiring 300 ms of one run is unproven on real speech.

So the check sums every counted frame again, and skips the capture's own sounds
instead: the clip's press offset plus the current set's start sound
(`feedback::start_tone_length`, zero with sounds off) and the output and input
latency it takes to reach the microphone. `DictationCapture::begin_stream`
passes that count with the stream (`Command::Begin`), so `PauseCap` still reads
its own samples and the 400 ms slack is untouched. The reason keeps the span of
the counted speech.

Checks: `hexs_own_sounds_at_the_captures_head_are_not_a_lost_opening` (the
same clip errs without the exclusion),
`a_lost_opening_after_a_long_pause_still_falls_back_to_the_whole_clip`.

`ReleaseTail` and `ReleaseWait` move to `src/dictation/release_tail.rs` to keep
`src/dictation.rs` under its size cap, and the docs say plainly that a release
handled late can still leave the stream past the clip's trimmed end.

* build: gate ReleaseWait and the zero-head begin to the platforms that use them

macOS has no ReleaseWait (Linux and Windows poll it), so the re-export and
its imports are gated there. The Windows bench is the one non-test caller of
a head-less stream, so it asks for no ignored head explicitly and Transcript-
ionEngine::begin stays test-only.

* docs: word the press window's margin and its blind spots accurately

The 60 ms margin after the start tone covers the 40 ms chord grace before a
provisional tone sounds plus a little latency, not the output and input
latency alone. With sounds off only the pre-roll is excluded, and with
release-while-idle the tone sounds once the capture is intentional or ready,
so the window may not cover it. Say plainly that a short lost opening inside
the window, pre-roll speech included, goes unseen, that the earlier version
likely rejected streams rather than certainly doing so, and that only the
part of the tail audio the clip keeps is fed from the finished clip.
2026-11-16 14:36:17 -05:00
Dax fc94374310 Windows: re-arm the keyboard hook when another app comes to the front (#1901) (#1910) 2026-11-16 14:35:06 -05:00
Dax 72ac81ad61 fix(meetings): finish recordings across quits and update restarts (#1900)
* fix(meetings): recover recordings lost to a quit or update restart

Rune ends a quitting app with `_exit` unless it is told the app has work
after its loop, so every in-app quit (Quit Hex, `hex quit`, Restart to
update) skipped Hex's drain since the Nov 14 Rune bump. A meeting
recording was killed mid-write: zeroed WAV headers, no `final.pending`,
and nothing to recover at the next launch.

- `rune::orderly_exit()` in the macOS, Windows, and Linux app loops, so
  the existing teardown runs on every quit; the AppKit terminate path
  still drains from its will-terminate notification.
- macOS joins the meeting controller before installing a staged update
  and before the other workers, and a recording gets 30 s to finalise
  rather than 5.
- `meeting::recording()` is a process-wide flag the updater reads.
  Restart to update refuses with a reason, re-checks before swapping,
  and keeps the release staged.
- Launch recovery selects every unlocked unfinished meeting, not just
  `final.pending`; repairs zeroed or wrong WAV RIFF/data sizes from the
  file length, fills sample counts and duration from the audio, and runs
  the existing final pass so the transcript, Markdown export, and notes
  are written. Failed and completed meetings are untouched.

Checks: `a_zeroed_wav_header_is_repaired_from_its_file_length`,
`a_stranded_recording_is_selected_for_recovery`,
`recovery_fills_the_manifest_from_the_repaired_audio`,
`the_flag_holds_until_the_recorder_drops_it`,
`restart_to_update_waits_while_a_meeting_records`.

* fix(meetings): settle recovery attempts and keep retention honest

Reviews of #1900:
- a recovery that dies during the final pass leaves recovery.attempt;
  the next launch marks the meeting Interrupted ("recovery did not
  finish") and never retries that audio. final.pending folders that
  already have a transcript are finished too.
- a repaired, unfinalised track overwrites list_all's relabel with the
  audio's real duration and ended_at.
- retention only waits for stranded meetings while recovery can run
  (Meetings on, model installed); the MCP query uses the same rule.
- repair only rewrites a zero or overlong data chunk, so a trailing
  chunk or pad byte is never read as audio.
- the macOS status item dims Restart to update while a meeting records.
- finish_restart keeps Ready only when an update is staged.
- macOS installs a staged update before joining the controller when
  nothing records; Windows arms a 20 s teardown deadline; Linux writes
  its reopen marker only after a restart is accepted.
- the recording flag is a counter, tested without assuming idleness.

* fix(meetings): bound recovery retries and harden quits

- recovery.attempt now counts attempts: a pass that dies is retried once,
  then the meeting is marked Interrupted ("recovery did not finish") and
  that audio is never handed to Hex again. The pass holds the meeting
  busy flag, so the quit deadline and Restart to update wait for it.
- a finished meeting with a stale attempt marker keeps its final.pending,
  which the ordinary final pass then exports; settling no longer deletes
  it.
- pending recoveries stop between meetings when a recording starts and
  are offered again once Hex is idle.
- an empty finalised track is not "unfinalised"; the audio's duration
  wins whenever repair changed the manifest's track counts.
- can_recover reads meetings.enabled and the model from settings.json in
  readers (`hex mcp`, `hex meetings`), matching the app.
- updater: State::Applied is never overwritten by a later check, and a
  restart check that races a quit never swaps a second time.
- macOS installs the staged bundle before joining the meeting
  controller, marks quitting before any drain, and extends the 5 s exit
  deadline to 30 s from the quit's start while meeting audio is in
  flight. `meeting::record` refuses once quitting.
- Windows marks quitting after the loop, bounds teardown at 20 s (30 s
  while meeting audio is in flight) and exits 1 when the window failed;
  Linux marks quitting before joining meetings and removes a reopen
  marker when a restart is refused.

* fix(updater): keep the staged update installable when a late download is dropped

- check() now returns the state the locks actually show when it discards a
  release during a quit: Applied only if one was installed, else Ready while
  an older update is staged, else Current. install_on_quit therefore still
  installs the staged update a plain quit is about to apply.
- after waiting for meeting audio, the macOS exit deadline gives the rest of
  the drain up to 5 s more, inside the 30 s bound from the quit's start.
  Windows polls meeting audio to 30 s instead of choosing a bound once.
- the Restart to update refusal reads "Hex is finishing a meeting; restart to
  update when it's done", true for a recording and a launch recovery.
- a recording refused because Hex is quitting removes the empty folder it
  created (and only when it holds nothing but the lock file).
- docs: the macOS drain installs before joining the controller, and the
  deadline/discarded-release wording matches the code.
2026-11-16 12:30:57 -05:00
Dax fb8db1d02f labs: keep long holds through other keys (#1475) (#1890)
* add labs › keep long holds through other keys (#1475)

A shortcut with no key, held more than a second, no longer loses a
dictation to a joining key or click on macOS and Windows: the key
reaches the app in front and the release still finishes. Before the
first second, and with the lab off, chords discard exactly as before.

macOS reads the gate in DictationHotkey; Windows reads it in the hook,
where the capture keeps the press's tick count for the same second.

* labs: shorten hold through other keys copy

The card now reads "Hold through other keys", with a one-clause summary
that fits the card. Translations say the keys reach the app and no longer
end the dictation, and "a second or more" matches the >= code.

* labs: tighten hold through other keys translations

The translated summaries fit the two-line card now (74-83 characters
for the Latin and Cyrillic columns, 28-42 for Chinese and Japanese), and
no longer add a clause about keys reaching the app. Ukrainian and Russian
titles fit the card, and the labs doc says which goldens changed and that
macOS clicks were already ignored after 300 ms.

* labs: fix hold through other keys translations

Grammatical Spanish, Portuguese, German, Japanese and French copy from
review, with the French title shortened by two words because "Maintenir
malgré d'autres touches" clipped in the card. The dictation doc now says
the Windows tests need Windows and run in Check Windows.
2026-11-16 08:18:53 -05:00
Dax 32934acec4 labs: stop phrase finishes a hands-free dictation (#1886)
* labs: stop phrase finishes a hands-free dictation (#1884)

* stop phrase: finish to idle, fire on committed words, tidy logs
2026-11-16 06:19:37 -05:00
Kit Langton db06244662 Play requested Sounds previews while Hex volume is Off (t1581) (#1880) 2026-11-15 22:29:41 -08:00
Dax f1afb3c06a fix: recognize ardia and zen as browsers (#1875)
* fix: recognize ardia and zen for pause browser media

Ardia (com.ardia.browser, audio in com.ardia.browser.helper) and Zen
(app.zen-browser.zen, helpers under app.zen-browser) were missing from the
browsers microphone activity knows, so Also pause the browser never heard
them and left them alone.

Add both to the browser list, Ardia's helper and Zen's whole app.zen-browser
prefix to the canonical mapping (Zen's helpers are app.zen-browser.*, never
org.mozilla.*), and their display names. The prefix keeps the existing dot
boundary, with negatives for app.zen-browserx and com.ardia.browserx.

* fix: recognize ardia and zen in call detection

The browser list microphone activity knows is shared with meeting
detection, so Ardia and Zen still read as unknown microphone apps there:
no browser-call offer, no Meet name from their titles, and Zen's
plugin-container never folded to its browser.

Add both to call detection's browser names, matching Zen's whole name
like Arc so Citizen and Zendesk stay out, strip their Chromium and
Firefox brand suffixes (Zen Browser and Zen Twilight on Windows and
Linux, no brand suffix on macOS), count Zen's plugin-container as a
helper, and cover each browser with a detection test plus Zen's
substring negative. Zen's Windows stem was already listed; Ardia has no
Windows build.

Docs: meetings' call detection and helper-process notes learn both.
2026-11-15 23:15:47 -05:00
Dax c4e361b214 labs: copy a dictation's kept audio as a file (#1860)
* labs: copy a kept dictation recording as a file

Adds the Copy dictation audio lab (Labs › History, off by default,
labs.copy_dictation_audio). It stores no audio: History entries that
Labs › Keep recordings gave a WAV gain Copy audio beside Play, and the
macOS menu bar and the Linux and Windows tray gain Copy last dictation
audio, which copies the newest entry that kept its audio. macOS uses
Scrawl's file pasteboard, Windows CF_HDROP, and Linux a text/uri-list
through the process's one LinuxPaster, which now lives in
linux::paste::with_paster so captures and History share it.

A missing recording or a refused clipboard says so under the row in
History, as a failed Play does; the menus log it, as Copy recent
dictations does. The newest-recording lookup skips entries whose file
is gone, with a unit test. Docs, translations, labs.json, and the Labs
goldens follow.

* labs: copy dictation audio off the UI thread and behind both switches

Review fixes for the Copy dictation audio lab:

- History's Copy audio now runs like Transcribe again: the file lookup on
  the window, then a worker named hex-copy-audio does the clipboard write
  (which can wait on another app, Annotate's paster, X11 or wl-copy) and
  reports Copied or the error back through the window's waker. The button
  reads Copying… while it runs.
- HistoryStore::newest_recording now takes now_ms and filters by the
  store's retention cutoff, like recent() and search(); the unit test
  covers a file deleted behind the store, the cutoff boundary, and an
  expired entry.
- The menu bar and tray item, and the History action, need both this lab
  and Keep recordings; the gate and every handler re-check both. A copy
  failure from the menu or tray stays logged, as the menu's other copy
  actions do, and the docs record that limit.
- Copy's text check and Copy audio's check clear each other.
- A UI test pins Copy audio absent with either switch off and present
  with both on.
- Card and site summary say menu bar or tray; the validateMenuItem doc
  names both dimmed rows; WindowsDesktopHost::history follows new(); the
  History feature map mentions the action.

* labs: hold text Copy behind a running Copy audio, and refresh the tray

Follow-ups from the PR review:

- A pending Copy audio keeps a text Copy from starting, since its worker
  still lands the WAV on the clipboard; text Copy only clears a settled
  audio state. The UI test pins it.
- The Linux and Windows trays compare Copy audio's availability with the
  last value, so a recording that appears or expires redraws the menu
  without a snapshot or publish change; the gate is read first and
  History only with a tray, keeping the check cheap.
- Move Copy audio's worker state into history/audio.rs so
  rune_ui/history.rs stays under the 1,500-line cap.
2026-11-15 12:08:47 -05:00
Dax 64234cc2e5 windows: keep opening the microphone when its default format can't be read (#1849)
* windows: keep opening the microphone when its default format can't be read (#1845)

A device that reports no default format was abandoned before the direct
WASAPI paths and the formats it lists were tried, which is the one failure
the Windows default-input handle hits and a named device does not: cpal
activates it through ActivateAudioInterfaceAsync rather than the endpoint.

Try those paths instead of returning, build the alternative formats from
the ranges alone (48 kHz, else 44.1 kHz, else the range's top) when there
is no default to match, and keep the read error, with the driver's reason,
for the message. The open thread, startup, and saved-microphone retries
render causes with {error:#}, and a released microphone that will not open
is logged where it used to fail silently.

* windows: name the ordered fallbacks for a microphone with no default format (#1845)

Review fixes: the Windows tree row lists Hex's own WASAPI paths before the
formats the device lists, matching the code; the module doc says a device
with no readable default format still tries them; and listing a device's
formats logs its cause like every other path.
2026-11-14 23:49:07 -05:00
Dax 687ea32d65 Bump Rune to 1899e64: overlays pace frames with the swap chain on Windows (#1832)
* Bump Rune to 1899e64: overlays pace frames with the swap chain on Windows

Windows HUD memory grew and the app could hang after dictation because the
overlay presented frames without waiting for swap chain room after Rune #844;
Rune #985 makes an overlay's frames wait for room in its swap chain, as a
window's do.

nix: vendor each Cargo source in its own directory. Rune's tiny-skia-path is a
path dependency inside Rune (a Git crate at 0.11.4 here), the same name and
version as resvg's from crates.io, and cargo's directory source keys a crate by
name and version alone.

Goldens: Rune's text drawing changed over the 152 commits since d6715352.

* Review: patch accesskit_macos, and make the nix vendor split name what breaks

Rune #975 put accesskit_macos in its [patch.crates-io], so Hex patches it too
(Rune's README asks consumers to); it is the fifth and last crate Rune patches.

The vendor script override now checks each fragment it rewrites and names the
missing one, its comment says crates.io goes to registry/ and Git sources to
git/, nixfmt formats the file, and check-nix-git-pins.py's docstring says the
hashes reach importCargoLock through the cargoDeps override.

* linux: keep Hex running when the window can't start

Rune r399 makes App::run print a startup error and exit 1 on native targets
instead of panicking, so a Linux Hex with no display died, the next launch
became a fresh instance, and Check Linux's single-instance exercise saw
`hex start` hang and `hex app --hidden` reset.

run_app now returns Rune's try_run error and run_window reports it and waits,
as it did for the panic (#979).

* macos, windows: take rune's startup error instead of exiting

Rune r399 prints a startup error and exits the process from `run` on
native targets, which skipped Hex's own stop: macOS's drain (workers,
event-log flush, a recording kept for the next launch) and Windows' GPU
draw-marker disarm, so the launch that failed before drawing was read as
a crash while drawing. Both apps take `try_run`'s error now, log it, and
stop the way Quit does; Windows also reports it from `hex app`. The
Linux window already took the error (#979).

* macos: a launch whose window never started exits 1

Taking Rune's try_run error lets the app stop through the drain, but
process_exit::finish ends with _exit(0), so a failed GUI launch reported
success. finish_with takes the code; the window's failure exits 1 while a
normal quit keeps 0.

* docs: overlays wait for swap-chain room on windows since rune #985

Rune #985 makes every overlay's frames wait for room in its swap chain, so
the notes that said only a window waits and that the HUD's 60 Hz timer worked
around a suspected cause were stale. The timer is a cap on top of the slot
wait now. The macOS and Windows startup-error comments cited #979, which is
the Linux window issue; they describe Rune r399 instead.

* windows: a failed start keeps the GPU draw marker

disarm() means a frame reached the screen or Hex quit cleanly; a start that
never drew is neither, so it keeps the marker and the next launch falls back to
the high-performance GPU.

* docs: say what was measured about overlay pacing

* docs: say what stays bounded on windows, not what shrinks

The meetings map and the dictation map described the fix as memory that no
longer grows, and as Rune holding a frame's slot and skipping it. Rune #985
defers the frame until its swap chain has room, then draws it, which bounds
the frames in flight; the growth itself hasn't been re-measured on Windows
with the fix.
2026-11-14 20:40:20 -05:00
Dax 9d040bacb1 feat(labs): let the rewrite read text around the cursor (macOS) (#1815)
* feat(labs): let the rewrite read text around the cursor (macOS)

* fix(labs): bound returned cursor text, escape tags, re-check lab at finish
2026-11-13 23:36:24 -05:00
Kit Langton 4dda1cb6ca feat(labs): YOLO mode presses Return after long dictations (#1812)
* Add Labs › YOLO mode: press Return after long dictations (t1558)

* Add a Labs YOLO mode scene (t1558)

* Update Labs goldens for YOLO mode (t1558)

* Box the Windows dictation output job (t1558)
2026-11-13 20:02:34 -08:00
Dax ba8b5698ac windows: keep per-language model choice when switching keyboard language (#1788)
* windows: follow the focused window's layout and ignore hex's own windows for keyboard model switching

* windows: skip a window that closed mid-read; log keyboard source changes at info
2026-11-13 11:18:21 -05:00
Kit Langton cfe995752a fix: query recording owners and unify transformation startup (t1549) (#1760) 2026-11-12 17:56:25 -08:00
Kit Langton 5341d57334 show the model preparation's real stage instead of always Downloading (t1537) (#1748) 2026-11-12 16:47:08 -08:00
Dax 9e3efa0d1c fix(macos): pause Helium with the other browsers (#1754)
* fix(macos): pause Helium with the other browsers

Helium (net.imput.helium) was missing from the browsers microphone
activity knows, so Also pause the browser never heard it and its
dictation pause went to whatever macOS had as Now Playing.

Add it to the browser list, its helper prefix (Chromium's audio service
reports net.imput.helium.helper), its Linux and Windows executables
(helium, helium-browser), and its display name. Meeting detection's
browser name matching and the feature maps learn it too.

* fix: finish Helium's browser recognition

Windows' BROWSER_STEMS missed helium, so its focused page was never read
through UI Automation and website modes saw no host. The browser tab-title
suffixes meeting detection strips missed " - Helium" too, so a Meet tab's
code was not extracted from a Helium title.

Add both, with the existing browser-stem and Meet-title tests extended.
2026-11-12 16:01:02 -05:00
Kit Langton f7a741cc8b fix(settings): preserve other writers' changes when saving (#1747)
* fix(settings): merge edits through one persistence owner (t1533)

* fix(modes): focus the adopted correction without duplicating it (t1533)

* fix(settings): publish reversions even before the host saw the save (t1533)
2026-11-12 12:57:21 -08:00
Kit Langton a3e786db67 fix(dictation): share correction order and keep stop-time context (t1534)
* fix(dictation): share processing and retain stop-time context (t1534)

* fix(dictation): keep queued jobs small and pass platform checks (t1534)

* fix(dictation): unpack queued job before moving its fields (t1534)
2026-11-12 12:48:45 -08:00
Kit Langton 4cd7f84005 start dictation on the fallback when a saved import is lost (t1537) (#1739) 2026-11-12 12:06:57 -08:00
Kit Langton 8ce167876a refactor: derive hand-kept lists and literals from one source (t1539) (#1749) 2026-11-12 11:58:11 -08:00
Kit Langton ce1a5b91b5 fix(onboarding): record the tour finished only when it finishes (t1538) (#1741) 2026-11-12 11:53:55 -08:00
Dax ff3751dd87 Keep a dictation for Paste Last when its paste fails on Windows and Linux (#1727)
macOS already kept the text for Paste Last when its paste failed (#1724).
Windows and Linux returned the paste error before saving the new text, so
Paste Last re-inserted the previous dictation.

Linux now takes the paste as a closure and keeps the processed text when it
fails; the listener sets its last dictation inside delivery, so success and a
failed paste both keep it. Windows saves it beside the paste and still returns
the original error. History stays success-only, printed dictations are
unchanged, and a cancelled capture never reaches this point on either OS.
2026-11-12 12:58:52 -05:00
Dax 2174ea2980 labs: screen vocabulary (macos) (#1719)
* add screen vocabulary lab (macos)

* screen vocabulary: fix review (model gate, visible text, extraction, pending read)

- read the screen only when the selected model uses terms: Parakeet needs
  Vocabulary biasing on and a boost other than Off; keep the live stream for
  models that ignore the terms
- read AXVisibleCharacterRange for large text values, check
  AXNumberOfCharacters before copying, and cap each value at 4 KB
- reject hex ids, ordinals, times, units, and random digit tokens; allow
  2-letter acronyms; add a small window-label stoplist
- gate the reader on a pending capture, allow one reader at a time, and test
  the begin/intend/cancel sequence
- document the Parakeet gate, the whole-clip cost, the soft deadline, and the
  debug count log

* screen vocabulary: match accessibility's CFNumberGetValue declaration

* screen vocabulary: drop long all-caps words and log markers

- require a lowercase letter in the mixed-case branch, so WARNING,
  DEPRECATED, and CHANGELOG are not terms while NVIDIA and PostgreSQL stay
- add INFO, DEBUG, ERROR, WARN, TODO, FIXME, NOTE, and TRACE to the stoplist
- list the new tests, including one_screen_read_runs_at_a_time, in the docs
2026-11-12 07:43:56 -05:00
Dax 74e8914261 labs: voice prompt, speak an instruction to rewrite one dictation (#1716)
* labs: add a spoken voice prompt for one-off OpenCode instructions

A new Output lab, off by default, splits a dictation at a spoken trigger phrase and replaces the mode's rewrite with one request applying the instruction after it to the text before it. The phrase is validated, saved as labs.voice_prompt_phrase, and shown on its card while the lab is on.

* labs: refine voice prompt matching and quiet empty output

Hyphens and apostrophes inside a word are ignored instead of breaking it, the pieces keep their own punctuation, and Windows/Linux finish a deliberately empty voice prompt quietly through a Processed flag. Also keeps the phrase field's caret through unrelated saves, resyncs it when the lab toggles elsewhere, maps it to the OpenCode lock, reads the browser host on every OS, and extends courtesy phrases.

* labs: read the quiet voice prompt signal on macOS

macOS skips the output through CompletedTranscript.nothing, and its Processing stage now uses the same prepared text and replacements the request does, so it shows only when a request would actually run.

* labs: trim the marks around a spoken voice prompt

Quotes, brackets, and spaced dashes that only set the phrase off leave the split, while punctuation inside the text survives. Windows and Linux treat a deliberately empty prompt as a discard rather than an empty paste, macOS reads the browser host for the request, and the OpenCode lock covers the phrase setting too.

* labs: keep quotes that don't touch the spoken phrase

A quote or bracket pair leaves the split only when its opening mark touches the phrase, and terminal punctuation inside the pair is allowed. The empty outcome closes the oldest Linux HUD job directly and records a discard reason Activity names, with translations.

* labs: keep the voice prompt discard helper out of macOS builds
2026-11-12 07:18:02 -05:00
Dax 689e5b35e9 labs: keep the microphone open after dictating (#1701)
* labs: keep the microphone open after dictating

With Release microphone while idle on, a capture that ends now leaves the
microphone open for a Labs window (`labs.keep_microphone_open` +
`labs.keep_microphone_open_seconds`: 30 s, 1, 3, 5, or 30 minutes, default
1 minute), so the next dictation takes the warm path with its pre-roll
instead of the cold open's asynchronous start. Off, every listener closes
exactly as before, and with the release setting off the lab does nothing.

One `audio::linger::MicrophoneLinger` decides it for macOS, Windows, and
Linux: the first idle pass after a capture arms the window, a capture clears
it, and only a later idle pass past the window closes, once nothing records,
no client dictates, no release tail runs, and no capture copies the
microphone. Windows and Linux move their repeated `release_while_idle &&
!wants_audio()` closes into that one check; macOS reconciles through it. The
switch takes the Labs state word's last free bit; the window has no room
there, so it lives in its own atomic, both written by `labs::apply`.

Also moves Linux's Live typing glue into `linux/dictation/typing.rs`, since
`linux/dictation.rs` was at the source cap, and regenerates the Labs goldens
for the new card.

* labs: release the lingering microphone where the old sites did

Review fixes for keep-microphone-open:

* macOS reconcile_input keeps origin/dev's branches: with a capture sink
  open and an inactive input, recovery is still requested, and the lab's
  window is cleared while a sink holds the microphone.
* A digital-silence finish closes a lingering microphone instead of
  skipping recovery, so the next press opens a fresh stream. macOS does it
  in reopen_silent_stream; Linux's moved to linux/dictation/silence.rs
  (which also keeps linux/dictation.rs under the source cap). Windows has
  no digital-silence path.
* Windows and Linux run the release check at the old event sites (a
  submitted finish, a cancel, a discard before the open, a client's end)
  through one small macro, so a press handled in the same pass still sees
  a closed microphone when the lab is off. That check also releases a
  microphone an interrupted recording left open, which the old
  latch-based sites never did.
* Docs: drop the "exactly as before" claims, describe the extra close, the
  Annotate capture-sink and local-API windows, macOS ending the window on
  a stream interruption, and the Linux poll rather than an idle wait.
* clear() is real code now (the silence close); state()/apply() say why
  the switch bit and the window atomic are written separately.

* labs: keep the lab's windows and spots exact

Follow-ups from review:

* Windows releases the microphone when a pending client dictation's start
  gives up at the first chunk, which the old site closed too.
* macOS leaves a lingering microphone alone when a digital-silence finish
  lands while a capture sink copies it, so Annotate gets no gap.
* The Linux silence test's released case opens the input first, so it really
  covers "lab off, release while idle: no reopen, stream stays open".
* Docs say where a digital-silence finish ends the window (macOS and Linux,
  not with a capture sink on macOS) and that Windows can linger on a
  zero-only stream.
2026-11-11 18:12:08 -05:00
Dax 6637ea120b audio: back off when a reopened microphone keeps stalling (#1683)
* audio: back off when a reopened microphone keeps stalling (#1681)

* audio: prove a stream by its delivery, retry on press everywhere (#1681)
2026-11-11 01:50:46 -05:00
Dax 03e34b751c windows: recover from a lost gpu after standby; hud and gpu marker fixes (#1652)
* windows: hud recovers after a frame-less show; logoff no longer leaves the gpu draw marker

* bump rune for lost gpu device recovery
2026-11-10 21:02:53 -05:00
Kit Langton f6b2c9cdc5 fix(windows): keep Launch at login on the installed version after a manual upgrade (t1510) (#1670) 2026-11-10 17:34:25 -08:00
Dax 1fa4a4709e labs: switch speech model with the app in front (#1640) (#1644) 2026-11-10 16:06:00 -05:00
Dax 4ce280f2a6 labs: second dictation shortcut on linux and windows (#1651)
* labs: second dictation shortcut on linux and windows (#1648)

* docs: second dictation shortcut mid-capture on windows
2026-11-10 14:40:02 -05:00
Dax 341d440928 windows: closing the main window releases its window and swapchain (#1622)
* windows: closing the main window releases its window and swapchain (#1308)

Windows kept the window hidden after a close (keep_running), so its Direct3D
window and swapchain stayed alive while Hex sat in the tray. NVIDIA's Instant
Replay takes a hidden DXGI window in the process for the running game, so
launching Hex visibly and then closing it left Hex as the capture target.

release_gpu_when_closed destroys the native window and drops the device on
close, as the hidden overlays already do (release_gpu_when_hidden). The tray,
a second launch, and `hex window show` open a new one from the same handle;
the close asks for the size the closing window had first, so a window the user
resized reopens as they left it rather than at AppSpec's size.

Not yet observed with NVIDIA's App, and on x64 the speech model's Vulkan
device may still trigger the same detection.

* windows: keep the window's place across a close, not just its size

The closed window now also records its outer position through Rune's
WindowHandle::set_position, which keeps the position on the window's options
and applies it when the next window is created, so a window the user moved
reopens where they left it.

keep_window_size is keep_window_frame now. A maximized, minimized, or
full-screen frame is still left alone: Rune has no way to reopen a window
maximized (App::maximized only applies to a first creation, and
Tx::toggle_maximized toggles a live window), so that remains unimplemented.
2026-11-09 22:34:51 -05:00
Dax f8d09781b0 labs: apply While dictating only on speakers (#1610)
Adds Labs > Only on speakers: with the lab on, "While dictating" applies
only while the default output is speakers; wired or Bluetooth headphones
leave the output and media alone for that recording or capture.

The route is read once per session on the recording environment's worker
thread (macOS) or the audio-control worker (Linux and Windows), never the
event tap's or the dictation loop's. macOS reads the default output's
CoreAudio transport, jack data source, and UID; Linux reads pactl's default
sink and its active port or form factor; Windows reads the default output's
WASAPI form factor through cpal. Anything unclassified counts as speakers.

Also reads the route on Linux and Windows, where a skipped session runs no
pactl or cpal. Closes #1601.
2026-11-09 20:24:42 -05:00
Dax c71e89a6d2 feat: labs appearance setting to force light or dark (#1599)
* feat: labs appearance setting to force light or dark (#1590)

* fix: appearance lab title bar and review fixes

* fix: re-apply the forced title bar after windows settings broadcasts

* fix: only re-apply a forced caption, and drop the subclass on destroy

* test: refresh labs goldens after rebase
2026-11-09 15:47:38 -05:00
Dax 1843603caa local api: optional output processing behind a lab (#1597)
* local api: optional output processing behind a lab

* local api: share one processing state with listeners

* local api: process one transcript at a time

* docs: clarify the processing route checks
2026-11-09 10:35:05 -05:00
Dax c8b8cdfbed close a dead microphone stream before reopening it (#1577)
* close a dead microphone stream before reopening it

* docs: say dictation stream
2026-11-09 05:19:40 -05:00
Dax cae389a833 windows: keep dictation on clipboard and copy dictation only labs (#1546) (#1549) 2026-11-08 12:33:26 -05:00
Dax 5ca56d9d42 unload idle: start with the model unloaded (#1544)
* unload idle: start with the model unloaded

With Labs › Unload model when idle on, the macOS, Linux, and Windows listeners start parked instead of loading the GGUF model at launch. The first dictation reloads it through the existing idle-reload path. Apple Speech still loads at launch.

* unload idle: keep a prepared linux model, republish streams, report reload errors
2026-11-08 11:00:26 -05:00
Dax b1a37aaa78 Labs: terminal paste shortcut on Windows and Linux (#1534)
* Add Labs terminal paste shortcut for Windows and Linux

* fix windows build: drop the unused key_down from input/modifiers

* allow the terminal-paste shortcut code to go unused on macos

* mask the second shortcut's menu modifier on auto-repeats

the mask was only set on the first press, so process_button cleared it on each
repeat key-down and a held capture over the repeat delay leaked a bare alt/win
release. set it on every trigger key-down like the dictation key and paste
last do.

* keep side_matches private

* keep the shortcut and dictation helpers under the source cap

windows/dictation.rs, rune_ui/general.rs, and linux/dictation.rs crossed 1,500
non-test lines after the rebase. move the registered-shortcut tables and the
General pane's shortcut rows into submodules, and refresh the Linux Labs
golden for Transform typed text and Terminal paste shortcut.

* call the global setting Terminal paste in typed text's refusal

the lab now owns the name Terminal paste shortcut, so the typed-text errors
and log line must name the global paste_with_shift setting instead.

* drop the terminal paste lab's unused encoded bit

no accessor reads it and no other lab has a bit without a reader; the feature
reads its saved switch directly through Feature::on.

* raw dictation has a hex command; the terminal paste shortcut does not
2026-11-08 07:30:29 -05:00
Dax 24eb49c7ff Labs: Transform typed text shortcut (Linux) (#1525)
* feat(linux): labs transform typed text shortcut (#1519)

* fix(linux): harden typed-text clipboard handling

* fix(linux): keep dictation clipboard fallback, sync typed-text keybinding

* refactor(control): keep shortcut text in its own settings module

settings.rs crossed the 1,500-line limit when Labs added the typed-text
key; the shortcut text parsing and formatting is the one self-contained
concern, so it moves to settings/hotkeys.rs unchanged.
2026-11-08 05:43:46 -05:00