Skip to content

Menu bar panel - #24

Merged
9clg6 merged 19 commits into
mainfrom
oats-menubar
Nov 23, 2026
Merged

9clg6 merged 19 commits into
mainfrom
oats-menubar

Conversation

@9clg6

@9clg6 9clg6 commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

What

  • Status item in the menu bar with a non-activating panel: note state and elapsed time, start/stop/pause, last three transcript lines (never a marker), current question and proposed answer, meeting suggestion, open Oats, quit. Native AppKit views fed by one channel (com.icitranscript/status_panel); the snapshot is built by a pure Dart function and pushed at most ~4 times per second.
  • A new meeting suggestion opens the panel without activating the app, and closes it after 12 s.
  • Closing the main window hides it; the app stays in the menu bar and a recording goes on (an activity is held against App Nap while a note records).
  • Quit (panel, Cmd+Q, Dock, logout) takes one path: the note is stopped and saved, the session is registered for backfill, the processes Oats owns are stopped, then the app terminates, within a bound.
  • A backfill attempt registers its session as pending before it starts, without counting the attempt.
  • The live view model fills the note title.

Checked

  • Tests: app 1722, core_data 160, core_domain 58; analyze clean; debug build.
  • Offscreen renders of the panel views, light and dark.

Not checked

  • Nothing was run on screen: status item, panel behaviour (click outside, Escape), Cmd+Q, Dock quit and logout are unverified.

Clement Guyon added 19 commits November 23, 2026 02:20
…e waits

The real startSession awaits the previous post-processing before it marks
the note recording, so two panel clicks in that window could start twice;
the fake now waits there too, so the double-start spec needs a real guard.
Real-VM specs wait up to 10 s like the calendar specs (3 s flaked before).
Proof: dart analyze reports only the missing production names.
The native panel reads only this map, so the speaker label and the
suggestion title/detail now live in one function each, shared with the
live screen and the shell prompt instead of being copied.

Proof: status_panel_snapshot_test.dart, 23 green.
…ts clicks

The panel lives in another process space (AppKit), so Dart owns the
state: statusPanelSyncProvider sends the snapshot at launch, on each
change (at most every 250 ms, last state always sent) and in full on
'ready', and maps the panel's clicks onto the same paths as the window
(startOrShowNote, stopSession, suggestion start/dismiss, retry).
Double clicks are folded by in-flight guards; quit stops and saves the
note, waits for a finalisation started from the window, then asks the
native side to terminate. The live view model now fills sessionTitle.
RootAppWidget mounts the sync once the kernel is ready.

Proof: test/features/status_panel/, 58 green.
During a call in another app the Oats window is out of sight, so the
recording state, the last lines, the live question and the meeting
suggestion now live in an NSStatusItem with an AppKit panel that never
activates the app. It renders only the last Dart snapshot, sends the
clicks back, and asks for a fresh snapshot ('ready') when opened.
Closing the main window now hides it (performClose -> orderOut) and the
app no longer quits with its last window; the Dock click and
'showWindow' bring it back; 'terminate' quits through NSApp.

Proof: flutter build macos --debug succeeds; an offscreen render of the
real panel views (swiftc against the built FlutterMacOS, invented
content) was looked at in light and dark. The live menu bar behaviour
was not run.
flutter analyze reported two unused imports left by the shared speaker
label and the sync provider.
…ck restore

An offscreen check showed the red close button calls close() without
going through performClose(_:), so the override would have really closed
the window. windowShouldClose(_:) is called for both the button and
Cmd+W (checked with a swiftc script) and, per its doc, not on quit.
Reopen now returns true when a window is visible (minimized counts), so
AppKit still restores a minimized window from the Dock.

Proof: flutter build macos --debug succeeds.
…ithin a bound

Quit (panel, Cmd-Q, Dock) must stop the note, then every server Oats
launched, then terminate; skip the finalisation; be idempotent; send
terminate within 30 s even if a stop hangs or a signal fails. The tail
must drop both marker kinds without losing a line.
Proof: new specs red (servers alive at terminate, no skip, two
terminates, untranscribed marker shown; stopAll missing); existing
panel specs green.
Main now writes a second marker kind (Passage non transcrit). The panel
reuses the grouping's marker predicate, made public, instead of a
second copy, so neither kind takes one of the three lines.

Proof: status_panel_snapshot_test.dart green.
A model server of several GB outlived the app until the next launch.
Quit (panel, and soon Cmd+Q / Dock) now stops and saves the note,
skipping a finalisation (the audio is on disk, the backfill resumes at
next launch), then stops every process in the registry through the new
OwnedProcessRegistry.stopAll() (group signals, failures logged and left
for the next launch's cleanup), then sends terminate. Each step is
time-boxed (10 s + 18 s) so terminate always leaves within 30 s, and a
repeated quit reuses the same run.

Proof: status_panel_quit_test, owned_processes_stop_all_test and the
other panel and platform specs, 222 green.
Cmd+Q, the app menu, Dock › Quit and logout bypassed the note save and
left the model servers running. applicationShouldTerminate now answers
terminateLater, sends 'quit' to Dart and replies when Dart calls
'terminate' — or after 35 s, or at once if Dart has no handler or
errors — so the app can never refuse to quit.

The vibrancy material rendered mid-grey with filled grey buttons. The
panel now draws the app tokens (oats_tokens.dart) per appearance: white
or near-black ground, hairline border and separators, outlined 6 px
buttons with a single filled primary, and the accent green only on the
recording dot.

Proof: offscreen renders of the real views, light and dark, for idle,
recording with an answer, finalising and both suggestions, looked at.
…owStart key

Review of PR #24. Quit skips the finalisation then kills the server, so
the session must already be pending on disk (attempt not counted) when
terminate is sent; the next launch then restores the sentence once, at
its time. Each new suggestion key sends one 'suggest' call (never while
recording or dictating, window hidden included); the snapshot's
'showStart' hides the generic start while a suggestion shows.
Proof: quit-backfill red (no pending file at terminate; relaunch half
checked green with the expected disk state); suggest red (no call);
showStart red (key missing).
Quit skips the finalisation and stops the server, promising the backfill
resumes at next launch; but an attempt in flight wrote the pending file
only after its outcome, so quitting mid-attempt left nothing on disk and
the skipped text was stranded. The session is now written as pending
(count unchanged) before the attempt starts; only a finished attempt
that reached the server increments the count.

Proof: status_panel_quit_backfill_test (both cases) and the backfill
specs under test/application/services green.
A suggestion shown only in the snapshot stays unseen until the panel is
opened. Dart now sends 'suggest' {key, kind, title, detail} once per new
key, never during a note or a dictation, so the native side can open the
panel. The snapshot gains showStart (idle and no suggestion) so only one
'Démarrer la note' is ever shown, and 'truncated' also covers answers
shortened by the new parser (the contract has a single key for it).

Proof: status_panel specs, 85 green.
…p Nap

terminateLater runs the loop in NSModalPanelRunLoopMode: Flutter
messages still flow (FlutterRunLoop uses common modes, engine 3.38.4),
but DispatchQueue.main blocks do not (checked with a swiftc script), and
AudioCapturePlugin answers through the main queue, so stopping a note
could stall until the bound; the 35 s safety block itself would never
have fired. Cmd+Q and Dock Quit now cancel, let Dart quit, then call
terminate again (as FlutterAppDelegate does). Logout/restart/shutdown
(quit Apple event with a reason, or willPowerOff) still use
terminateLater so they are not aborted, bounded by a timer added in
common modes.

'suggest' opens the panel without activating the app nor taking key
focus, and closes it after 12 s unless the pointer is inside; never over
an open panel. The generic start button follows showStart and the
suggestion's start is the filled primary. A recording holds a
userInitiated activity so a hidden window is not napped.

Proof: debug build; offscreen renders of the suggestion states (panel
visible, not key, app not active).
@9clg6
9clg6 merged commit e9119f8 into main Nov 23, 2026
2 checks passed
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.

1 participant