Repository navigation
Ariadne: the menubar tray (icons, badges, overflow, clock) on ImGui, FTXUI and tvision - #1241
Merged
Merged
Conversation
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.
…dne/menubar-tray-proto # Conflicts: # src/cvc/ariadne/loader.cpp
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.
…5.22 (master's labels took 5.21)
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 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All five phases of the menubar tray, the design Joe picked on 2026-11-14:
Ready for review; merge only on Joe's OK.
What it does
tray_icon:in amenubar:. Drawn at the bar's right end, after the menus and the Windows menu. It takes: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:, oritems: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 | alwaysat the top level, orcollapse:on a- menubar:entry, decides. The default isauto;neverkeeps phase 1's behaviour;falsereads asnever.Backend::menus_fit(titles, tray)is asked each frame; its default says the menus fit. ImGui measures asBeginMenulays the bar out; FTXUI and tvision count columns.HostedMenuItemwithsubmenuset and its items onedepthdeeper; tvision nests them as its own submenus.menuicon is now≡(U+2261). Arial and DejaVu Sans Mono have no☰(U+2630), so ImGui drew it as?.The clock.
- clockplaces it.Runtime::set_clockis the host's default: arigl and ari turn it on inrun, never insnapshotorcheck.clock: true|falseoverrides the host.ariadne.tray.clock(arigl's Settings > Show clock) overrides both.Runtime::set_wall_clockpins the time for tests.ASCII. A backend without the glyphs (
Backend::unicode_glyphs) draws each named icon's ASCII stand-in.Backends.
FtxuiBackend::hosted_tray()is the model.Phase 3: notifications (§5.24). One feed per
cvc::app(cvc/core/notify.h, an app slot), so two apps never share one.as:, which the runtime takes from the program's scope.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 intonotify.*for widgets to bind (/notify.unread).(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.AppRuntime's own;schedule_published_jobjobs when they end: failures always, info for jobs of a second or more, never a cancel;conf.*, so nothing replicates.Runtime::set_notifications, the document'snotifications:,- bellto place it in a menubar, and arigl's Settings > Show notifications.TrayIcon::iconnames it. Terminals draw 🔔, or*without glyphs.Phase 4: loaded documents as applications (§5.25). The outermost document owns the bar.
load:-ed document with its ownmenubar:is an application: its bar becomes one menu of the outer bar, after the outer document's menus and before Windows.meta.name, else its mount id. Two mounts of one document are told apart by their ids.on_tick:and its programs. Its state is kept.init:run,on_tick:started.examples/ariadne/documents/apps_demo.ariloadstray_demo.ariandapps/counter.aritwice.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.Pong.wall_nsfield carries the answerer's wall clock. WS and gRPC both send it. An older peer sends 0, which means no reading.state_link_stats::note_peer_clocktakes 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 gainpeer_clock,clock_offset_msandclock_rtt_ms.cvc/core/server_clock.hholds one reading percvc::app, stale after 15 s.relay_sessionwrites it once a second while joined and clears it when it leaves or loses the relay.Follow-ups.
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)
ariadne_runtime_test(299 tests),state_link_stats_test(5),ariadne_ftxui_test(110),ariadne_loader_test(233),result_job_test(18) andjob_intrinsics_test(21) all pass. The new tests:Tray*tests and both clock tests;ARepeatedLoadedDocumentIsAnApplicationPerInstance,TwoBarsOfADocumentShareOneClockAndBelland FTXUI'sASecondBarContinuesTheFirst. Snapshots of a two-bar document in arigl and ari both showFile Edit … ⚙1 ✉3and one clock;StateLinkStatsTest.PeerClockTakesTheShortestRoundTripandTheClocksTooltipGivesTheRelaysTime. The WS and gRPCLinkProbeMeasuresRoundTripAtBothEndstests now also check that each end gets a peer clock within 1 s of zero;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-runsinit:and drops the state);TwoMountsOfOneDocumentAreToldApart;ADocumentWithoutAMenubarShowsItsLoadedDocumentsMenus;ALoadedDocumentIsNamedByItsMeta;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;JobKeysfailure (an error entry) and stop (no entry) tests;ari testofsrc/ari/tests/chat_component.ari: 11 cases pass, including a newa_direct_message_goes_to_the_feed;TheMenusFoldIntoOneWhenTheyDoNotFitBesideTheTray,ADocumentSetsWhetherTheMenusFold, the loader'sMenuCollapseSetting, FTXUI'sANarrowBarFoldsItsMenusIntoOne(fold, dropdown, click an item) andAFoldedBarIsOneMenuOfSubmenus(the hosted model).ari_*,arigl_*,cvcgl_ari_golden,cvcgl_ari_switchandcvcgl_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.ariin 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 snapshotof the demo, with phase 3, shows the drawn bell with a badge of 1 before the clock;ari snapshotat 70 columns showsFile View Notify Help Windows ✉12 ⚙2 ⚠3 🔔1 22:50.arigl snapshotofexamples/ariadne/documents/tray_demo.ariat 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 snapshotat 30 columns shows≡ ✉12 ⚙2 ⚠3 22:21; at 60 the menus are back.ari snapshotshows✉12 ⚙2 ⚠3 17:07right-aligned. WithTERM=dumbit shows@12 %2 !3.arigl run --terminal --backend tvisionshowed the tray over the menu bar row.Not checked
≡) is built and its hosted model is tested, but it has not been seen on screen.≡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.cvc.dlldoesn't link with WS or gRPC on. CI's WS and gRPC jobs are the first build of them.ari test's fake room verbs.Left for later