Skip to content

Ariadne: the menubar tray (icons, badges, overflow, clock) on ImGui, FTXUI and tvision - #1241

Merged
transfix merged 11 commits into
masterfrom
ariadne/menubar-tray-proto
Nov 16, 2026
Merged

transfix merged 11 commits into
masterfrom
ariadne/menubar-tray-proto

Conversation

@transfix

@transfix transfix commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

All five phases of the menubar tray, the design Joe picked on 2026-11-14:

  • the tray (docs/ARIADNE.md §5.22);
  • a narrow bar folding its menus into one (§5.23);
  • the host's notification feed with the tray's bell (§5.24);
  • loaded documents' menubars as menus of the outer bar (§5.25);
  • the relay's time in the clock's tooltip (§5.22).

Ready for review; merge only on Joe's OK.

What it does

  • tray_icon: in a menubar:. Drawn at the bar's right end, after the menus and the Windows menu. It takes:

    • a named icon (warning error info check gear mail sync user network star clock menu, cvc/ariadne/icons.h) or any text;
    • badge: (text or expression; "" and "0" show none);
    • tone: (info, warn or error);
    • tooltip:;
    • on:, or items: for a menu.
  • Overflow. On a narrow bar the menus fold first (phase 2, below). If the tray still lacks room, icons go, from the left, into a » icon. Its badge sums theirs and its tone is the strongest. The menus, folded or not, never yield to the tray.

  • Phase 2: the fold (§5.23). When the menus and the whole tray don't fit, the menus become one ≡ menu at the bar's left end, each menu a submenu, the Windows menu included.

    • menu_collapse: auto | never | always at the top level, or collapse: on a - menubar: entry, decides. The default is auto; never keeps phase 1's behaviour; false reads as never.
    • Backend::menus_fit(titles, tray) is asked each frame; its default says the menus fit. ImGui measures as BeginMenu lays the bar out; FTXUI and tvision count columns.
    • Hosted, a submenu is a HostedMenuItem with submenu set and its items one depth deeper; tvision nests them as its own submenus.
    • The menu icon is now ≡ (U+2261). Arial and DejaVu Sans Mono have no ☰ (U+2630), so ImGui drew it as ?.
  • The clock.

    • Shows HH:MM; its tooltip is the date and the time to the second.
    • It goes last unless - clock places it.
    • Runtime::set_clock is the host's default: arigl and ari turn it on in run, never in snapshot or check.
    • A document's top-level clock: true|false overrides the host.
    • The state key ariadne.tray.clock (arigl's Settings > Show clock) overrides both.
    • Runtime::set_wall_clock pins the time for tests.
  • ASCII. A backend without the glyphs (Backend::unicode_glyphs) draws each named icon's ASCII stand-in.

  • Backends.

    • ImGui: right-aligned in the main menu bar. Glyphs are 1.3× the bar's text, text icons (the clock) are drawn at the bar's text size, and badges are pills.
    • FTXUI: after the bar's filler, with badges in their tone's colour. A menu icon's dropdown hangs left from its right edge. Hosted, FtxuiBackend::hosted_tray() is the model.
    • tvision: an overlay on the right end of the menu bar row, where tvision's demo puts its clock. A click opens a popup menu, and hovering shows the tooltip in the status line.
    • A backend with no tray gets each icon as an ordinary menu.
  • Phase 3: notifications (§5.24). One feed per cvc::app (cvc/core/notify.h, an app slot), so two apps never share one.

    • Every document posts to the same feed, loaded ones included, so there is nothing to propagate. Each entry is named by its mount's as:, which the runtime takes from the program's scope.
    • C++: cvc::notify, notify_read, notify_clear, notify_clear_under, notifications, notify_status. It keeps the newest 100 entries, and an identical unread post counts as a repeat. It is mirrored into notify.* for widgets to bind (/notify.unread).
    • DSL: (notify TEXT [LEVEL [ON]]), (notify-read ID), (notify-clear ID), (notify-read-all), (notify-clear-all) (only the calling document's own entries), (notify-status) and (notify-list [N]). A clicked entry's ON runs in the scope, and with the functions, of the document that posted it.
    • What posts on its own:
      • every runtime warning, and AppRuntime's own;
      • schedule_published_job jobs when they end: failures always, info for jobs of a second or more, never a cancel;
      • the chat component's direct messages, while their conversation is not shown. The feed sits outside conf.*, so nothing replicates.
    • The bell is a built-in tray icon before the clock, shown while the feed has entries. Its badge is the unread count and its tone the worst unread level. Its menu lists the newest 8 entries, then Mark all read, Clear all, and Show all..., which opens a Notifications window.
    • Whether it shows: Runtime::set_notifications, the document's notifications:, - bell to place it in a menubar, and arigl's Settings > Show notifications.
    • ImGui draws the bell itself, since its fonts have none; TrayIcon::icon names it. Terminals draw 🔔, or * without glyphs.
  • Phase 4: loaded documents as applications (§5.25). The outermost document owns the bar.

    • Its menu. A load:-ed document with its own menubar: is an application: its bar becomes one menu of the outer bar, after the outer document's menus and before Windows.
      • The menu is titled by its meta.name, else its mount id. Two mounts of one document are told apart by their ids.
      • It holds its menus as submenus, drawn in its scope with its functions, then Restart and Quit .
    • Quit removes its windows, menu and tray icons and stops its on_tick: and its programs. Its state is kept.
    • Restart also drops its state and notifications and starts it again: holes planted, init: run, on_tick: started.
    • Windows > Applications shows each application as a toggle, ticked while it runs: untick to quit, tick to reopen.
    • Its tray icons join the outer tray, evaluated in its scope.
    • No bar of its own: a document without a menubar gets a bar for its applications.
    • Window ids: inside a mount, a window's backend id carries the mount's prefix, so a document loaded twice shows two windows. Before, the backends merged them into one.
    • Demo: examples/ariadne/documents/apps_demo.ari loads tray_demo.ari and apps/counter.ari twice.
  • Phase 5: the relay's time in the clock's tooltip (§5.22). When the host is joined to a relay, the tooltip adds a second line like wss://relay/room: 14:05:11 (+2.50 s, round trip 18 ms): the relay's time, its offset from this host's clock, and the round trip the reading came from.

    • Proto: a new Pong.wall_ns field carries the answerer's wall clock. WS and gRPC both send it. An older peer sends 0, which means no reading.
    • The offset: state_link_stats::note_peer_clock takes the peer's time as read half a round trip before the Pong arrived. Of the last 8 readings it keeps the one with the shortest round trip, as NTP does. The link counters gain peer_clock, clock_offset_ms and clock_rtt_ms.
    • Publishing: cvc/core/server_clock.h holds one reading per cvc::app, stale after 15 s. relay_session writes it once a second while joined and clears it when it leaves or loses the relay.
  • Follow-ups.

    • Two bars in one document share one row. In FTXUI the second bar continues the first instead of replacing it. In ImGui the tray puts the cursor back where the menus ended, so a bar begun again appends after them rather than off-screen. The second bar's tray goes left of the first one's, and the clock and the bell appear in the first bar only.
    • A repeated loaded document (repeat:) becomes one application per instance, " 1", " 2", each in its own scope and each quit or restarted on its own.

Checked (Windows, Release, MSVC)

  • With master merged in (it includes Ariadne windows: close and maximize buttons by default, restore glyph, manual resize ends a maximize #1220's window chrome): ariadne_runtime_test (299 tests), state_link_stats_test (5), ariadne_ftxui_test (110), ariadne_loader_test (233), result_job_test (18) and job_intrinsics_test (21) all pass. The new tests:
    • the runtime's Tray* tests and both clock tests;
    • the FTXUI tray layout, overflow, mouse click, an on-screen dropdown, and the hosted model with activation;
    • follow-ups: ARepeatedLoadedDocumentIsAnApplicationPerInstance, TwoBarsOfADocumentShareOneClockAndBell and FTXUI's ASecondBarContinuesTheFirst. Snapshots of a two-bar document in arigl and ari both show File Edit … ⚙1 ✉3 and one clock;
    • phase 5: StateLinkStatsTest.PeerClockTakesTheShortestRoundTrip and TheClocksTooltipGivesTheRelaysTime. The WS and gRPC LinkProbeMeasuresRoundTripAtBothEnds tests now also check that each end gets a peer clock within 1 s of zero;
    • phase 4:
      • ALoadedDocumentsMenubarIsOneMenuOfTheOuterBar (order, one bar, Applications, the scoped tray badge, an item runs in its scope);
      • QuitKeepsALoadedDocumentsStateAndRestartResetsIt (quit hides it and keeps its state, reopen from Windows, restart re-runs init: and drops the state);
      • TwoMountsOfOneDocumentAreToldApart;
      • ADocumentWithoutAMenubarShowsItsLoadedDocumentsMenus;
      • the loader's ALoadedDocumentIsNamedByItsMeta;
    • phase 3:
      • Notify.TheFeedIsEachAppsOwnAndMirrorsItself (two apps, repeats, the cap, clear-under);
      • TheBellShowsTheFeedInTheTray (badge, tone, menu order, Mark all read, Show all opens the window, Clear all);
      • ProgramsAndWarningsPostToTheFeedFromTheirDocument (a mount's entries are named by it, a click runs ON in its scope, a warning is named by the mount);
      • ADocumentPlacesOrTurnsOffTheBell;
      • JobKeys failure (an error entry) and stop (no entry) tests;
    • ari test of src/ari/tests/chat_component.ari: 11 cases pass, including a new a_direct_message_goes_to_the_feed;
    • phase 2: TheMenusFoldIntoOneWhenTheyDoNotFitBesideTheTray, ADocumentSetsWhetherTheMenusFold, the loader's MenuCollapseSetting, FTXUI's ANarrowBarFoldsItsMenusIntoOne (fold, dropdown, click an item) and AFoldedBarIsOneMenuOfSubmenus (the hosted model).
  • The 34 ctests ari_*, arigl_*, cvcgl_ari_golden, cvcgl_ari_switch and cvcgl_imgui_* all pass, the ImGui goldens among them, after phase 4 too. The bell shows only while the feed has entries, so the goldens are unchanged.
  • apps_demo.ari in ari at 110 columns: File tray demo Counter (counter) Counter (counter_2) Windows ✉12 ⚙2 ⚠3 ★ ★ 🔔1. The arigl snapshot shows the same bar, and both Count windows.
  • arigl snapshot of the demo, with phase 3, shows the drawn bell with a badge of 1 before the clock; ari snapshot at 70 columns shows File View Notify Help Windows ✉12 ⚙2 ⚠3 🔔1 22:50.
  • arigl snapshot of examples/ariadne/documents/tray_demo.ari at 900 px shows File View Help Settings Windows, three badged icons and the clock. At 360 px the menus fold to ≡ and all three icons and the clock still show.
  • ari snapshot at 30 columns shows ≡ ✉12 ⚙2 ⚠3 22:21; at 60 the menus are back.
  • ari snapshot shows ✉12 ⚙2 ⚠3 17:07 right-aligned. With TERM=dumb it shows @12 %2 !3.
  • arigl run --terminal --backend tvision showed the tray over the menu bar row.

Not checked

  • tvision clicks, its popup menus and the status-line tooltip (no way to click from here). The tvision fold (nested submenus under ≡) is built and its hosted model is tested, but it has not been seen on screen.
  • Opening the ImGui ≡ menu and its nested submenus has not been clicked through; the snapshot only shows the folded bar. ImGui draws ≡ at the bar's text size, which is small; it could use the tray's 1.3× glyph size.
  • macOS, Linux and wasm builds: CI will run them.
  • The WS and gRPC transport changes and their two test additions have not been compiled locally. The local protobuf and gRPC libraries were built with a newer MSVC runtime, so cvc.dll doesn't link with WS or gRPC on. CI's WS and gRPC jobs are the first build of them.
  • The tooltip against a live arisrv.
  • Opening the bell's menu and the Notifications window in a real window, and the chat component's notification against a live relay. The chat case runs only against ari test's fake room verbs.

Left for later

  • Nothing.

Exploration, not for merge as is. A menubar entry `tray_icon: <glyph>`
is drawn right-aligned after the menus: `badge:` (a text or an
expression, as a picture's badge is) over its corner, `tone:` (info,
warn, error) its colour, `on:` what a click does, or `items:` a menu it
opens. The core collects the bar's tray icons and asks the backend
(Backend::begin_tray) how many of the last ones fit beside the menus;
the rest go, in order, into a » overflow menu whose badge sums theirs.
The menus never yield. A backend without a tray (the default) shows
each icon as an ordinary menu at the end of the bar, so the terminal
backends keep working unchanged.

ImGui draws it: the glyphs a little larger than the bar's text, the
badge a pill in the tone's colour. examples/ariadne/documents/
tray_demo.ari shows three icons.
Phase 1 of the menubar tray (docs/ARIADNE.md §5.21).

- tray_icon: takes a named icon (warning, error, info, check, gear,
  mail, sync, user, network, star, clock, menu; cvc/ariadne/icons.h)
  or any text. A backend without the glyphs (Backend::unicode_glyphs)
  draws each name's ASCII stand-in.
- The tray's clock: HH:MM, last unless `- clock` places it, its tooltip
  the date and time to the second. Runtime::set_clock is the host's
  default (arigl and ari: on in run, off in snapshot and check), a
  document's top-level `clock:` overrides it, and the state key
  ariadne.tray.clock (arigl's Settings > Show clock) overrides both.
  Runtime::set_wall_clock pins the time it reads.
- FTXUI draws the tray after the bar's filler, badges in their tone's
  colour; a menu icon is a menubar title whose dropdown hangs left from
  its right edge. Hosted, FtxuiBackend::hosted_tray is the model.
- tvision draws the tray over the right end of its menu bar's row, as
  its demo does with its clock: a click on a menu opens a popup, and the
  pointer on an icon shows its tooltip in the status line.
- ImGui draws text icons (the clock) at the bar's text size.
- Tests: ariadne_runtime_test's Tray* and the clock's settings,
  ariadne_ftxui_test's tray layout, overflow, clicks and hosted model.
@transfix transfix changed the title Ariadne prototype: a tray at the menubar's right end Ariadne: the menubar tray (icons, badges, overflow, clock) on ImGui, FTXUI and tvision Nov 14, 2026
@transfix
transfix marked this pull request as ready for review November 15, 2026 03:30
When the bar is too narrow for its menus and its whole tray, the menus fold
into one menu at its left end, titled with the "menu" icon (now U+2261, which
Arial, DejaVu Sans Mono and terminals all carry; U+2630 drew as "?"), each
menu a submenu, the Windows menu included. The tray keeps the right end.

- Backend::menus_fit(titles, tray): asked each frame after
  begin_main_menu_bar; the default says they fit. ImGui measures as
  BeginMenu lays a bar out, FTXUI and tvision count columns.
- menu_collapse: auto | never | always at the top level, or collapse: on a
  menubar entry. auto is the default; never keeps phase 1's behaviour.
- The hosted model gives submenus as HostedMenuItem{submenu, depth};
  tvision nests them as its own submenus, and a title that starts with a
  symbol gets no Alt key.
…d 5.24)

One notification feed per cvc::app (cvc/core/notify.h; an app slot, never a
process-wide one). Everything that runs in the app posts to it: the outer
document, every document it loads, the host, and the jobs they start. There is
nothing to propagate: a loaded document's entries go to the same feed, named
by its mount's as:, taken from the program's scope.

- cvc::notify / notify_read / notify_clear / notify_clear_under /
  notifications / notify_status; newest 100 kept, an identical unread post is
  a repeat; mirrored into notify.* for a widget to bind (/notify.unread).
- DSL: (notify TEXT [LEVEL [ON]]), (notify-read ID), (notify-clear ID),
  (notify-read-all), (notify-clear-all) (this document's own), (notify-status),
  (notify-list [N]). A clicked entry's ON runs in the poster's scope with its
  functions.
- Sources: every Runtime warning and AppRuntime's own, at warn, named by
  the document that raised it; schedule_published_job's jobs when they end
  (failures always, jobs of a second or more as info, never a cancel); the
  chat component's direct messages while their conversation is not shown
  (the feed is outside conf.*, so nothing replicates).
- The bell: a built-in tray icon before the clock, shown while the feed has
  entries; badge the unread count, tone the worst unread level. Its menu lists
  the newest 8, then Mark all read, Clear all and Show all..., which opens a
  Notifications window. Runtime::set_notifications, a document's
  notifications:, `- bell` in a menubar, and arigl's Settings > Show
  notifications (ariadne.tray.bell).
- ImGui draws the bell (its fonts have none; TrayIcon::icon names it);
  terminals draw the bell emoji, or * without glyphs.
…outer bar (ARIADNE.md 5.25)

The outermost document owns the menu bar. A document it loads with a menubar
of its own is an application: its bar is not drawn where it is but becomes
one menu of the outer bar, under its meta.name (else its mount id; two mounts
of one document are told apart by their ids), after the outer document's menus
and before Windows. The menu holds its menus as submenus, drawn in the mount's
scope with its functions, then Restart <name> and Quit <name>.

- Quit: its windows, menu and tray icons go; its on_tick: and the programs it
  started stop; its state stays.
- Restart: Quit, drop its state subtree and notifications, start again (holes
  planted, init: run, on_tick: started).
- Windows > Applications ticks the running ones; untick to quit, tick to
  reopen as it was. A quit one's windows are not listed meanwhile.
- Its tray icons join the outer tray, worked out in its scope.
- A document with no menubar of its own gets a bar for its applications.
- Inside a mount, a window's backend id carries the mount's prefix, so a
  document loaded twice has two windows.
- plan_windows_menu records each mount's bar; the loader names a mount by
  its fragment's meta.name (Widget::app_name), which also names its
  notifications.
- examples/ariadne/documents/apps_demo.ari loads tray_demo.ari and
  apps/counter.ari twice.
Joined to a relay, the clock's tooltip adds the relay's time on a second line,
with the relay's clock minus this host's and the round trip the reading came
from: "wss://relay/room: 14:05:11 (+2.50 s, round trip 18 ms)".

- state_transport.proto: Pong.wall_ns, the answerer's wall clock as it
  answered (0 from an older peer). WS and gRPC both send it.
- state_link_stats::note_peer_clock: the peer read its clock half a round
  trip before the Pong arrived; of the last 8 readings the one with the
  shortest round trip is kept (as NTP picks). counters gain peer_clock,
  clock_offset_ms and clock_rtt_ms.
- cvc/core/server_clock.h: one reading per cvc::app; stale after 15 s.
- relay_session writes it once a second while joined and clears it when it
  leaves or loses the relay.
transfix added a commit that referenced this pull request Nov 15, 2026
- #1241: the schema's menu_collapse was an enum, so a bad value warned twice (the schema, then
  the loader, which falls back to auto) and MenuCollapseSetting counted 2. The enum also refused
  the yes/no/on/off the loader takes. The schema now checks only the type (boolean or string);
  the loader's warning, which names the fallback, is the one.
- #1258: master's ShippedComponentsLoadClean includes each component file's unit named after it.
  nav_lab_panels.ari had only nav_lab_stats and nav_lab_ledger. It gains nav_lab_panels, a group
  of both windows; the two includes still work as they did.
- #1257: cvcgl_ari_golden found orthoslicer.ari in the golden set with no orthoslicer.png. This is
  the frame the test rendered (Linux, NVIDIA), checked by eye.
- The chart is in libcvc 4.0, not 3.7.14: data_feed.ari, nav_lab_*.ari and NAV_LAB.md.
…ded document's bar is hoisted

- FTXUI: a document's second bar continues the first instead of replacing
  it: its menus after the first one's, its tray left of the first one's tray
  (and laid out in the room that tray leaves). menus_fit counts the earlier
  bar too.
- ImGui: end_tray puts the cursor back where the menus ended, so a bar begun
  again this frame appends after them rather than past the tray; a second
  bar's tray goes left of the first one's.
- The core draws the clock and the bell in the document's first bar only.
- §5.25 a repeated mount (repeat:) with a menubar is an application per
  instance, "<name> 1", "<name> 2", each in its instance's scope, quit and
  restarted on its own. plan_windows_menu records its template;
  plan_frame_apps expands the instances each frame with per-instance copies of
  the bar; a menubar is skipped in place when drawn in an application's scope.
…rmat changed include lines

A menu_collapse: value outside the enum warns twice when json-schema-validator is
built (the loader's warning and the schema's), once without it. The test now expects
whichever applies. The include lines this branch touched are re-aligned by
clang-format.
transfix added a commit that referenced this pull request Nov 15, 2026
- #1241 (AriadneLoader.MenuCollapseSetting): the schema's menu_collapse was an enum, so a bad
  value warned twice (the schema, then the loader, which falls back to auto), and the enum refused
  the yes/no/on/off the loader takes. The schema now checks only the type; the loader's warning,
  which names the fallback, is the one.
- #1257 (cvcgl_ari_golden): orthoslicer.ari had no orthoslicer.png. This is the frame CI renders
  (Linux, from #1270's earlier run; Windows renders the same).
- The chart is in libcvc 4.0, not 3.7.14: data_feed.ari, nav_lab_*.ari, nav_lab_stats.ari and
  NAV_LAB.md.

#1258's earlier failures (its component test and NavArms on macOS and Windows) are fixed on its
own branch now.
transfix added a commit that referenced this pull request Nov 15, 2026
#1241's latest head expects both warnings where the schema validator is built, so 4de8782's
loosening of the enum would now fail its MenuCollapseSetting.
@transfix
transfix merged commit fac4d7a into master Nov 16, 2026
28 checks passed
@transfix
transfix deleted the ariadne/menubar-tray-proto branch November 16, 2026 06:21
transfix added a commit that referenced this pull request Nov 16, 2026
Conflicts (includes in ariadne.h, ariadne.cpp and ariadne_runtime_test.cpp; three hunks of
#1241's menubar tray in ariadne.cpp) keep both sides. #1241's code meets this branch's groups:

- An action's context keeps master's scope (a quit application's actions stop) and is built by
  this branch's finish_context.
- The notify verbs bind by kind with the backend's (install_backend_verbs is now
  install_host_verbs): host_proxied in an `any` group, as cvc::notify mirrors the feed into
  the app's notify.* subtree raw on the caller's thread.
- What they capture (scope, source, a copy of mount_names) is taken on the host thread when a
  context is made (NotifyScope); a spawned child, made on the thread that pumps its group, binds
  from its parent's copy through its spawn context instead of reading mount_names there.
- quit_app kills the application's actions on current_sched() (the document's group), not
  only on group 0 when this Runtime used it.
- drain_begin runs builtin_event before the handler seam, through this branch's `m`.

Tests: AriadneIsolatedDocs.TheNotifyVerbsRunOnTheFramesThread (the feed is written on the
frame's thread while a worker pumps the program; a spawned child posts as its parent's scope)
and AriadneIsolatedDocs.QuitKillsALoadedDocumentsActionsInItsGroup.
STATE_EXEC_THREADED.md: the notify verbs' row, Quit among the kills that go to the group, and
the spawned child's notify scope.
transfix added a commit to cy-pca/nicotina that referenced this pull request Nov 16, 2026
…s bell, unread DMs counted (L25) (#31)

The web app's bar, in the menu bar's tray (transfix/libcvc#1241, the libcvc release after 4.0.0),
where the host has (notify); elsewhere nothing changes, and min_libcvc stays where it is.

- Every 30 s while signed in, a quiet poll. TX.WTF's unread notifications go to the host's
  notification feed, whose bell shows them; a click opens the post or profile and marks it read at
  the instance. A direct message from someone else that comes while its conversation isn't shown is
  unread here: the tray's mail icon counts those conversations, DMs marks them, and the feed has an
  entry that opens it. txwtf's conversation list has no unread count, so nicotina keeps one.
- A direct message's emoji draw as a post's: its content_html, or for an encrypted one the
  instance's custom emoji (GET /social/emojis).
- The nicotina menu's Maximize the window, where the backend has the button (ui.maximize).
- "1 conversation".

CI: ci/install-hosts.sh installs ari-media in a prefix of its own, with the libcvc of its release
pinned, when its newest release isn't ari's (libcvc 4.0.0 published no ari-media,
transfix/libcvc#1288, and ari-media 3.7.13 beside libcvc.so.4 couldn't start). It finds the newest
releases through cvcpkg.org's search API. With #30's taller panes for the link and
attach walks (the link walk 50 rows, for ari-media's video poster).

Tests: the stub's ivy gets a message from grace right after her first look, per-notification
viewed, the custom emoji list; tests/run.sh checks the tray where the host has the feed, and the
FTXUI walk uses the menu's Maximize.
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