diff --git a/CHANGELOG.md b/CHANGELOG.md index 3400fe6..b09afa5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,21 @@ User-visible changes of the apps and the `tsgw` gateway. The format follows at once. `VOELIN_METER=1` counts the renders of each pane; `VOELIN_DEMO_SERVER` and `VOELIN_DEMO_TALK` pick the sample server and make a sample person talk (docs/ui.md, "The channel tree and the members"). +- The GPUI front end's voice channel page and call bar. A server's Voice channel + button (or `VOELIN_OPEN=voice`) shows the channel we are in with its topic, + its banner and who is there: large avatars ringed green while they talk and + blue while they stream, with the marks of a microphone or sound that is off, + and under them the call bar (mute, deafen, share and the voice settings, which + only log until their pages come, and Leave). The smaller stage, one row of small + avatars, is remembered and a window under 800 pixels tall always has it (the + same setting as the Slint app's). The sidebar's server card shows the server's + banner, a person's card has their volume and a mute for us, and the voice card + says the transmit mode when it is not push-to-talk. Hold to talk no longer + stays on when voice drops while it is held or when the window loses the focus, + and the global push-to-talk key (`Ctrl+Shift+T` by default, as in the Slint app) + works while another window has the focus. A person's picture is round in its + avatar. `voelin-gpui` is still not the app (docs/ui.md, "The voice page and + the call bar"). - Log files: each run logs to `/voelin/logs/voelin.log`, the previous four runs are kept; `VOELIN_LOG` sets what is logged. Settings → Advanced opens the folder. diff --git a/docs/design/gpui-spikes.md b/docs/design/gpui-spikes.md index 8d67391..cb1499e 100644 --- a/docs/design/gpui-spikes.md +++ b/docs/design/gpui-spikes.md @@ -66,8 +66,17 @@ banner is drawn under the surface veil of the Slint tree's `BannerPicture`, an avatar under 28 pixels shows one letter, the password prompt ignores an empty field and closes on Escape, and the `ui.tree` row of the settings table, the list of the Bridge's properties and callbacks that the two panes use and some -long lines are corrected in docs/ui.md. The next slice is the voice page and the -call bar. +long lines are corrected in docs/ui.md. Slice 3, the voice page and the call bar, +landed on `phase5/gpui-voice` (2026-10-28): the page as a cached pane of its own +that takes the main area (its people from the tree model's one build, so a talker +is still one build for three lists), the call bar and the smaller stage kept in +`ui.voice_compact`, the sidebar's server card with its banner, the voice card's +transmit modes and the volume of a person following the settings, the release +guard of Hold to talk (voice that drops, a window that loses the focus) and the +global push-to-talk key started on the engine's runtime; it was seen against both +development servers with a second client that talks. What it costs and what it +leaves is in docs/ui.md, "The voice page and the call bar". The next slice is the +chat, the composer and emoji. | Spike | The plan's no-go | Seen (software rendering, see Setup) | Verdict | |---|---|---|---| diff --git a/docs/ui.md b/docs/ui.md index dfd68cf..ce58f9d 100644 --- a/docs/ui.md +++ b/docs/ui.md @@ -663,7 +663,7 @@ live when they change (settings page, `--set`, another window): | `ui.members_width` | pixels | 280 | width of the members panel (dragging its edge sets it) | | `ui.window` | JSON `{width, height, x?, y?, maximized}` | none | where the main window was when the last run ended: its size (the one it returns to when `maximized`), its position where the platform tells one (Wayland does not: no `x` and `y`), and whether it was maximized; the next run opens there. Read at start, not applied live; written by the GPUI front end only (the Slint app neither registers nor reads it) | | `ui.tree` | JSON by server id: `{"": {collapsed, selected}}` | none | what each server's channel tree remembers: the channels folded shut (`collapsed`, channel ids) and the channel last selected (`selected`), under the id of the server's bookmark; a server with nothing folded or selected has no entry. Read at start, written at every fold, unfold and selection (not with the sample servers); written by the GPUI front end only (the Slint app neither registers nor reads it: its tree forgets both when it ends) | -| `ui.voice_compact` | bool | false | the voice channel view's smaller stage (its Smaller stage / Larger stage button sets it; windows under 800 px tall always have it) | +| `ui.voice_compact` | bool | false | the voice channel view's smaller stage (its Smaller stage / Larger stage button sets it, in both front ends; windows under 800 px tall always have it) | | `ui.image_preview_kb` | kilobytes | 8192 | pictures linked in chat (files and `[img]`) up to this size show as pictures (0: never) | | `notify.mentions`, `notify.private_messages`, `notify.pokes`, `notify.event_reminders`, `notify.friends_online` | off / app / desktop | desktop (friends: app) | what the bell and the desktop say about each kind | | `video.camera`, `video.background`, `video.resolution`, `video.mirror` | device id; none / blur; auto or WxH; bool | first camera, none, auto, true | the camera of the preview and the default of camera sources | @@ -990,6 +990,8 @@ crates/voelin-gpui/ and the callbacks of the Slint `bind/servers.rs` that the shell, the channel tree and the members have (over `voelin_ui_vm::servers:: {logic, sequence}`, which Slint calls too) + hotkey.rs GlobalPtt: the global push-to-talk key's task, spawned on the engine's + runtime, its presses and releases handed to GPUI's thread through Later signals.rs `Update.refresh` as per-area signals: entities with a generation that the panes observe pictures.rs the engine's pictures on screen: decoded per file and stamp, the @@ -999,8 +1001,9 @@ crates/voelin-gpui/ title, the window's place shell/ the desktop shell and its panes (below): rail.rs, sidebar.rs, topbar.rs, main_panel.rs, channels.rs (the tree), members.rs (the - panel and its card), tree_model.rs, password.rs, form.rs, toast.rs, - actions.rs, widgets.rs + panel and its card, with the volume of a person), voice.rs (the + voice channel page and its call bar), tree_model.rs, password.rs, + form.rs, toast.rs, actions.rs, widgets.rs swatch.rs the swatch page (every token, widgets, icons) theme/ VoelinTheme: tokens.rs, components.rs, slint_parity.rs (test) fonts.rs Inter, from crates/voelin-ui/ui/assets/fonts @@ -1056,7 +1059,7 @@ crates/voelin-gpui/ exact row operations, a talker that redraws the tree and the members panel and no other pane, the member card, an avatar written again), a connect through a real engine that has no connector (it answers that none serves the address, which - reaches the status line), the store on a + reaches the status line), the voice page and the call bar (below), the store on a directory of its own, the theme (it reaches gpui-component, follows the window's appearance and the text size), the Slint file's tokens equal the Rust ones (below), the icons and fonts load. `tests/launch_failure.rs` starts the built @@ -1115,13 +1118,14 @@ anyway). | Switch | Does | |---|---| | `VOELIN_OPEN=swatch` | the swatch page in place of the shell; the Slint front end's other pages are not here yet and are named in a warning | +| `VOELIN_OPEN=voice` (`voice:compact`) | the voice channel page in the main area once voice is connected (with the sample servers the first one is, so at start); `voice:compact` on the smaller stage, which is not stored | | `VOELIN_DEMO_UI=1` | the Slint front end's sample servers (`voelin_ui_vm::dev::logic`) in place of the stored ones, through the app's own events (the first is connected, with its channels, people and their pictures, the second observed); nothing is sent to the engine or kept in the store, the window's place and what the trees remember included, and the servers cannot be changed. The pictures are files of a folder of the state's own in the temporary directory, removed when the window closes (a killed run leaves it) | | `VOELIN_DEMO_SERVER=2` | with the sample servers, the one on screen, counting from 0: the first (the default) is connected and populated, the second observed (its tree says it is loading), the third not connected (its tree says to connect) | | `VOELIN_DEMO_TALK=10` | with the sample servers, one sample person starts or stops talking this many times a second (a rate from 0.1 to 100), through the app's own events: what the meter measures while someone talks | | `VOELIN_DEV_THEME=dark\|light\|system` | the theme mode, in place of the settings' `ui.theme` | | `VOELIN_FONT_SCALE=1.25` | the text size factor, in place of the settings' `ui.font_scale` | | `VOELIN_WINDOW_SIZE=1440x960` | the window's size, in place of the remembered one (`ui.window`), which it then leaves alone: the window's place is not kept while it is set | -| `VOELIN_METER=1` | the cost meter: once a second a log line (`voelin_gpui::meter`) with the process's CPU, the CPU of each group of threads (`llvmpipe` is the software renderer, work a GPU takes over; `voelin-gpui` is GPUI's thread), the resident memory, the app's own counters per second (engine events, ticks, renders: one render is one pass of the window's root view, a frame; the renders of each pane, `rail`, `topbar`, `sidebar`, `tree`, `main` and `members`; `Later` jobs) and the voice connections up | +| `VOELIN_METER=1` | the cost meter: once a second a log line (`voelin_gpui::meter`) with the process's CPU, the CPU of each group of threads (`llvmpipe` is the software renderer, work a GPU takes over; `voelin-gpui` is GPUI's thread), the resident memory, the app's own counters per second (engine events, ticks, renders: one render is one pass of the window's root view, a frame; the renders of each pane, `rail`, `topbar`, `sidebar`, `tree`, `main`, `members` and `voice`; `Later` jobs) and the voice connections up | Screenshots are made headless, the way `scripts/shots.sh` makes the Slint ones: `scripts/gpui-shot.sh out.png swatch 1440x960` runs the binary under @@ -1199,15 +1203,16 @@ rendered with every frame ([what a change costs](#what-a-change-costs)). "Voelin"), the search box and the settings button, which log that their slices are to come (`OpenSearch`, `OpenSettings`). - **The sidebar** (`sidebar.rs`): the server on screen (name, "9 online · 9 - channels" once its presence is known, else its address), the channel tree - (slice 2), the voice card while voice is connecting or connected - (the channel we are in, copy an invite, disconnect, and Hold to talk when the - transmit mode is push-to-talk) and the user's card (nickname, Online, - Observing or Offline, the microphone and sound buttons, which work with - voice). + channels" once its presence is known, else its address, over the server's + banner when it has one: slice 3), the channel tree (slice 2), the voice card + while voice is connecting or connected (the channel we are in, copy an invite, + disconnect, and Hold to talk when the transmit mode is push-to-talk, else the + mode in words) and the user's card (nickname, Online, Observing or Offline, the + microphone and sound buttons, which work with voice). - **The main area** (`main_panel.rs`): "No server selected" with an Add a server button, or the server on screen (name, address, its state) with Connect or - Disconnect and Edit, until the voice page and the chat come. + Disconnect, Voice channel (while voice is connected: it opens the voice page, + [below](#the-voice-page-and-the-call-bar)) and Edit, until the chat comes. - **The server form** (`form.rs`), in the place of the main area until the dialogs slice: address (all a server needs), name (empty: the server's own), nickname (the default identity's, else the system user's) and the server's @@ -1243,8 +1248,9 @@ front end](#shared-with-the-slint-front-end)): The others of that file: `join_channel`, `join_with_password`, `toggle_collapse`, `search_members` and `open_client` are slice 2's ([the channel tree and the members](#the-channel-tree-and-the-members)); `show_voice_view` is the voice -page's (slice 3), `client_audio_changed` the dialogs', and `copied`, which the -Slint toast of a copy needs, `Invite` does for itself. `AddServer`, +page's (slice 3, [below](#the-voice-page-and-the-call-bar)), `client_audio_changed` +the dialogs' (the member card has the volume of a person, `SetMemberVolume`), and +`copied`, which the Slint toast of a copy needs, `Invite` does for itself. `AddServer`, `CancelServerForm`, `OpenSearch` and `OpenSettings` are the shell's own. #### Shared with the Slint front end @@ -1289,7 +1295,8 @@ state: the thread hop of the gateway lookup (`look_up_gateway`: each front end runs `sequence::find_gateways` on the engine's runtime and comes back through its own `Later`/`later`), `perform` (what an `Update` does to a window), the status line's toast, the invite's clipboard write, `HostedEngine` (`engine.rs`), -the guards of the GPUI shell's save (`save_refused`: the sample servers are not +`GlobalPtt` (`hotkey.rs`: the global key's task needs the engine's runtime and the +front end's own way back to its state), the guards of the GPUI shell's save (`save_refused`: the sample servers are not kept, and a server needs an address, which the Slint dialog checks in `dialogs.slint` before it calls), the store at start (`Backend::open` against `run()`: the identity import, the crash reports and `--set` of the Slint one) @@ -1475,8 +1482,9 @@ What is on screen: power. The search narrows the sections to the names it matches. - **The member card**: a click on a person opens their card over the panel with a scrim a click outside closes: name, status, description, groups, badges (what - each is for on hover), talk power and country. It follows the person while it - is open and goes when they leave. + each is for on hover), talk power and country, and since the voice page the + Volume rows: what they are played at, a mute for us and a slider. It follows + the person while it is open and goes when they leave. - **The password prompt**: joining a channel that has a password and whose password was not given this connection asks for it (a card over the window, Enter joins); a password the server refuses asks again, in words. As in the @@ -1689,7 +1697,7 @@ seventh standing in for the chat. The callbacks are GPUI actions | `connect_voice` (`channels.slint`, the server card's Connect) | `ConnectVoice` | slice 1 (the shell) | | `Nav.add_server`, `Nav.edit_server` (`channels.slint`, the server card's menu) | `AddServer`, `EditServer { id }` | slice 1 (the shell) | | `watch_client` (`channels.slint`, the LIVE tag of a person who streams) | none | the tag is drawn and not clickable: the stream viewer, slice 6 | -| `member_action("mute")` and `member_volume` (`members.slint`, the card's mute button and volume slider) | none | the card has no buttons yet: the person's volume, with `open_client` and `client_audio_changed`, the dialogs slice (9) | +| `member_action("mute")` and `member_volume` (`members.slint`, the card's mute button and volume slider) | `SetMemberMuted`, `SetMemberVolume` | slice 3: the card's Volume rows ([below](#the-voice-page-and-the-call-bar)); the volume dialog of `open_client` and `client_audio_changed` stays the dialogs slice's (9) | | `member_action("watch")` | none | the stream viewer, slice 6 | | `member_action("message")` | none | the chat, slice 4 | | `member_action("poke")` | none | the poke dialog, the dialogs slice (9) | @@ -1702,24 +1710,260 @@ seventh standing in for the chat. The callbacks are GPUI actions | `server_members` (`members.slint`) | `TreeModel::people` | | `member_total` (`members.slint`) | `TreeModel::total` ("Members — N") | | `member_card` (`members.slint`) | `TreeModel::card` (`voelin_ui_vm::tree::member_card`), shown by `MemberCardView` | -| `members` (the people in our channel: the voice page, not the two files) | built by `tree_view` and not shown: the voice page (slice 3) draws it | +| `members` (the people in our channel: the voice page, not the two files) | `TreeModel::voice` (`TreeEvent::Voice`), built with the other two lists and shown by the voice page (slice 3) | | `current_server` (`channels.slint`) | `AppState::vm.current` (slice 1) | | `observing` (`channels.slint`, `members.slint`) | `SidebarView::observing` (slice 1: the user's card says Observing); here also `Emptiness`, the words of a list with nothing in it: the tree's ("No server yet.", "Loading the channels…", "Connect to see the channels.") and the panel's ("Loading who is here…", "Connect to see who is here.", and "Nobody matches." for a search that leaves nobody of a server that has people); a server whose voice is connecting is loading | | `server_title`, `server_icon`, `server_stats` (`channels.slint`, the server card) | slice 1: the sidebar's server card (`ServerItem`'s name and icon, `SidebarView::stats`, "9 online · 9 channels") | | `voice_connected`, `voice_connecting` (`channels.slint`, the server card and its Connect) | slice 1: `SidebarView::voice_connected` and `voice_connecting`, the voice card ("Voice Connected", "Connecting…") | -| `server_banner` (`channels.slint`, the server card's picture) | not drawn: the sidebar's server card has no banner behind it. The same `BannerPicture` and veil (`widgets::banner_scrim`, which the tree's rows use) would do; it comes with the slice that lays the sidebar's cards again, the voice page and call bar (3) | +| `server_banner` (`channels.slint`, the server card's picture) | `SidebarView::server_banner`, behind the sidebar's server card under the same veil as the tree's rows (slice 3) | | `Nav.right_panel_width`, `Nav.right_panel_open` (the frame, `desktop.slint`, not the two files) | `ui.members_width`, read at start (no resize handle yet), and the panel is there while a server is on screen (the pins and topics drawers that share it come with the chat) | -`show_voice_view` (the voice page) and `client_audio_changed` (the volume -dialog) are the other server callbacks of the Bridge that these panes will meet -later; neither file uses them. +`show_voice_view` (the voice page, slice 3) and `client_audio_changed` (the volume +dialog) are the other server callbacks of the Bridge that these panes meet; +neither file uses them. What differs from the Slint tree and panel: the speaking bars stand still (nothing here may draw the window with the clock); the lists scroll with the wheel and have no scrollbar; a click on a channel -selects it where Slint opens its chat; the card has no buttons; the members +selects it where Slint opens its chat; the card has the volume and the mute of a +person and none of the buttons of the dialogs' slices; the members panel has no resize handle; the fill spacer's line is drawn with the channel's -own characters, as the rows give it; the sidebar's server card has no banner. +own characters, as the rows give it. + +### The voice page and the call bar + +Slice 3 of plan section 6 step 3: the voice channel page of the Slint front end +(`screens/voice.slint`, with the `Participant` of `voice-parts.slint`) and its +call bar, the sidebar's server card with its banner behind it, the release guard +of Hold to talk, the global push-to-talk key and the volume of a person, on the +same `voelin-ui-vm` rows (`TreeView::members`) and logic as the Slint front end. + +| The larger stage | The smaller stage | +|---|---| +| ![the voice page, dark](ui/gpui-voice-dark.png) | ![the voice page on the smaller stage, dark](ui/gpui-voice-compact-dark.png) | +| ![the voice page, light](ui/gpui-voice-light.png) | ![the voice page on the smaller stage, light](ui/gpui-voice-compact-light.png) | + +The pictures are the shell at 1440 by 960 under `scripts/gpui-shot.sh` (the +recipe above: `VOELIN_DEMO_UI=1` with `VOELIN_OPEN=voice` and `voice:compact`, a +display of its own, the state under the checkout's `.scratch/`), the release +build of `7140718`, Xvfb `:411` to `:414` of 3840 by 2160 with openbox, Mesa 26.2.5's +lavapipe (`llvmpipe (LLVM 21.1.8, 256 bits)`) through Vulkan. The first sample +server's Chill Zone: Kairo talks (the green ring and the bars in the corner of +the avatar, "Speaking"), Lumen streams (the blue ring, "Streaming" or LIVE), dex's +microphone is off (the mark in the corner), the channel's banner is behind the +header, and the server's own banner behind the server card of the sidebar. Two +more pictures are from the live run against the TeamSpeak 3 development server +([below](#seen-against-the-servers)): the voice page with a second client +that talks (a real `Event::Talking`), and the card of that person with the +volume rows. + +| A real talker (TeamSpeak 3 server) | The volume of a person | +|---|---| +| ![the voice page on a TeamSpeak 3 server, dark](ui/gpui-voice-live-dark.png) | ![a person's card with the volume, dark](ui/gpui-voice-card-dark.png) | + +What is on screen: + +- **The page** (`voice.rs`, `VoicePage`, a cached pane of its own). It is the main + area while the page is asked for and voice is connected (the Slint front end's + `Nav.voice-view && Bridge.voice-connected`): the server page's Voice channel + button asks for it (`ShowVoiceView { on: true }`, through `logic::show_voice_view`, + which also puts the people of our channel first in the members panel) and + the page's Chat only button gives the area back to the server page, where the + chat will be. A connection that drops takes the page away and a reconnect brings + it back, as in Slint (the flag is kept); Leave asks for the page off and leaves + voice (`LeaveVoice`: `show_voice_view(false)`, then the engine's + `DisconnectVoice`). `MainView` puts the page *instead of* the server page (they + are siblings, never nested: a cached view inside a view that renders again is + rendered again), so `panes.main` is not rendered while the page is up. +- **The header**: the channel's name, its topic, "5 in voice / 50 total" (the + limit when the channel has one) and, behind them, the channel's banner under + the same surface veil as the tree's rows (`widgets::banner_scrim`; the text + reads in the text colour instead of the secondary one over a picture). Copy + invite link (`Invite`), Smaller stage / Larger stage (`ToggleVoiceCompact`, + kept in `ui.voice_compact`, which both front ends read) and Chat only. +- **The people**, from `TreeView::members` as the model's `TreeEvent::Voice` (the + tree model builds the three lists once and tells the page its rows when they + differ, so the page builds nothing of its own): large avatars (80 pixels) in a + wrapping row, centred; a ring that is green while they talk and blue while they + stream (3 pixels, else 2 in the border colour), the mark in the corner of the + avatar (the speaking bars, else the headphones off, else the microphone off), the + name (ours in the accent colour) with the crown of an admin, and "Speaking", + "Streaming" or "Away" with the bars or the monitor mark. A click opens the + person's card (`OpenMember`). The smaller stage is one row of 54 pixel avatars + that scrolls sideways, ringed only while they talk or stream, the name and + the crown, and LIVE under a streamer. A window under 800 pixels tall has the + smaller stage whatever the setting says and the button is off, with the reason + as its tooltip (`Nav.short`): `MainView` tells the page when the window + crosses 800 pixels, since a cached pane does not see a resize. +- **The call bar**: Mute and Deafen (44 pixel round buttons, red while on: + `SetInputMuted`, `SetOutputMuted`), Share when the server can stream and the + voice settings (`OpenShare`, `OpenVoiceSettings`: logged, their pages are + the stream slices' and the settings slice's), and Leave. The streams of the + Slint page and its channel chat come with their slices; the page says so where + the chat will be. +- **The voice card and the modes.** Hold to talk is for the push-to-talk mode of + the audio settings; for voice activity and for an open microphone the card says + the mode in words instead of showing a button. `SettingChanged` for `audio`, + `client_playback` and `ui.voice_compact` is read again, as the Slint front end's + `setting_changed` does, so the modes, the volumes and the stage follow the + config file and the commands. +- **The volume of a person**: the member card (a click on a person on the voice + page or in the members panel) has the Slint card's Volume rows, the percentage, a + mute for us and a slider (0 to 200 percent in steps of 5), off for a person the + server gave no unique id. They are `SetMemberVolume` and `SetMemberMuted`, which + go through `voelin_ui_vm::settings_page::logic::{open_client, + client_playback_changed}` (the logic the Slint volume dialog calls: the engine's + `SetClientVolume` and `SetClientMuted`, the `client_playback` key by the person's + unique id, the tree's mark of who is muted). The dialog of `open_client` itself, + which the tree's click on a person asks for, stays the dialogs slice's. +- **The server card's banner**: `server_banner` behind the card of the sidebar, as + `ServerHeader` of `channels.slint` has it (the picture covers the card and is + cropped to its inside, the veil lies over it, the stats read in the text + colour). GPUI clips to rectangles, so the picture's corners are square, as the + tree's banner rows'. + +**The release guard of Hold to talk** (the risk slice 2 recorded). Two ways to let +go of the button without the button hearing of it, two guards. *Voice that +drops:* the voice card, with the button, goes when voice leaves `Connected`, and +the session keeps `transmitting` into the next connection. After each batch of +engine events the root state tells the session `SetTransmitting(false)` once for +every session that was connected before the batch and is not after it and still +says it transmits (the engine's own report, so no flag of ours can go stale; the +engine's answer, and a reconnect, are not answered), and the sidebar clears its own +hold from its observer of the state (it sets its own field and sends nothing: a +signal's observer does not change the root state). *A window that loses the focus +while the button is held:* the mouse button comes up elsewhere, so `MainView`'s +window-activation observer lets the button go and the root state tells the session. +The global key is for use while another window has the focus, so the focus is not +its to cut: it ends with the key's release or with the voice. Tests state each +(`hold_to_talk_is_released_when_voice_drops`, +`hold_to_talk_is_released_when_the_window_loses_the_focus`, the window that holds +nothing, the global hotkey that the focus does not cut, a voice that drops +without a hold), and each guard was removed once to see its test fail. + +**The global push-to-talk key** (`hotkey.rs`). `voelin_platform::HotkeyManager` +(the desktop's portal on Wayland, XInput2 on X11) runs in a task spawned on the +engine's runtime: the portal backend calls `tokio::spawn` when it is made, which +panics where no tokio runtime is current, and a GPUI foreground task has none +("For the next slices" said so). `run()` starts it once the window is open when +there is an engine, no sample servers and the settings (`ui`: `global_ptt`, on by +default, and `ptt_key`, `Ctrl+Shift+T`) ask for it; the state does not start it by +itself, so that a test of the state with a real engine never asks the desktop for +a shortcut (the first version of the commit did, and the test scheduler found it: +the status line came back from a tokio thread). Its presses and releases come to +GPUI's thread through `Later`: a press transmits into the session on screen while +it has voice, the release ends the session the press began in, whichever is on +screen then. How the key stands ("Active: Ctrl+Shift+T (X11)", why it could not +be registered) is in the log and `AppState::ptt_status`; changing the key at run +time (`AppState::set_global_ptt`) is the settings slice's. The loop is the Slint +front end's `GlobalPtt` repeated, as `HostedEngine` is. + +#### The callbacks and the properties + +The plan counts 6 properties and 6 callbacks. The properties the page reads, and +the callbacks of `bind/servers.rs` (and of `Nav`, whose functions call it) that its +controls have, each with what takes it here; the first six rows of each table are +the plan's six. + +| Slint property (used by) | Here | +|---|---| +| `members` (`voice.slint`) | `TreeModel::voice`, `VoicePage::people` | +| `own_channel` (`voice.slint`, the voice card) | `VoiceHead::channel` | +| `own_channel_topic` (`voice.slint`) | `VoiceHead::topic` | +| `own_channel_banner` (`voice.slint`) | `VoiceHead::banner`, the veil of `banner_scrim` | +| `own_channel_limit` (`voice.slint`) | `VoiceHead::limit` ("5 in voice / 50 total") | +| `server_banner` (`channels.slint`) | `SidebarView::server_banner`, behind the server card | +| `input_muted`, `output_muted`, `voice_connected` (`VoiceButtons`) | `VoiceHead`, the call bar's buttons | +| `audio.transmit` (`VoiceCard`) | `SidebarView::transmit`: Hold to talk, or the mode in words | +| `transmitting` (`VoiceCard`, `UserCard`) | `SidebarView::transmitting` (the button, the ring of our avatar) | +| `Nav.voice_view`, `Nav.voice_compact`, `Nav.short` | `vm.voice_view` (`logic::show_voice_view`), `AppState::voice_compact` (`ui.voice_compact`), `VoicePage::short` | +| `streams`, `messages`, `streams_available`, `can_share` | the stream slices' and the chat's; the call bar shows Share when `streams_available` | + +| Slint callback (used by) | Action | What it does | +|---|---|---| +| `show_voice_view` (`Nav.show-voice`) | `ShowVoiceView { on }` | `logic::show_voice_view`: the page asked for or not | +| `disconnect_voice` (the call bar's Leave, with `Nav.show-voice(false)`) | `LeaveVoice` | the page off, then `Command::DisconnectVoice` | +| `set_input_muted`, `set_output_muted` (`VoiceButtons`) | `SetInputMuted`, `SetOutputMuted` | the shell's, from the call bar too | +| `invite` (the header's Copy invite link) | `Invite` | the shell's | +| `open_member` (`Participant`) | `OpenMember` | slice 2's: the card | +| `voice_compact_changed` (`Nav.toggle-voice-compact`) | `ToggleVoiceCompact` | `ui.voice_compact` kept (not with the sample servers) | +| `push_to_talk` (`HoldToTalk`) | `PushToTalk` | the shell's, with the two guards above | +| `Nav.open-settings(voice)`, the share menu | `OpenVoiceSettings`, `OpenShare` | logged: the settings slice and the stream slices | +| `member_volume`, `member_action("mute")` (the card) | `SetMemberVolume`, `SetMemberMuted` | `client_playback_changed` | + +What differs from the Slint page: no members button (the panel is there while a +server is on screen), no streams and no chat under the call bar (their slices), no +Share menu (logged), the speaking bars stand still, the page does not open by +itself when voice connects (Slint's chat is its default; here the server page has +the Voice channel button, and `VOELIN_OPEN=voice` asks for it at start), and the +smaller stage keeps the people's avatars at 54 pixels where the phone's is not here. + +#### What the voice page costs + +`VOELIN_METER=1`, release build of `7140718`, 1440 by 960 on Mesa 26.2.5's lavapipe +through Vulkan on Xvfb `:431` and `:432` with openbox, the first sample server on +screen with the voice page open (`VOELIN_OPEN=voice`: the larger stage, nine +people on the server, five in Chill Zone), the machine's other jobs at a load +average of 10.1 before the first run, 3.7 between the two and 2.4 after (the one-minute figure); the first 15 seconds of 75 left out; CPU in percent of one +core, whose resolution is the 1 % of a clock tick; renders per second as the meter +counts them: + +| | CPU, mean (max) | Of it `llvmpipe` | GPUI's thread | Resident memory | Window frames a second | Rendered a second: rail, top bar, sidebar, tree, main, members, voice page | +|---|---|---|---|---|---|---| +| Idle, the voice page of the first sample server on screen | 0.3 % (2 %) | none | 0.1 % (1 %) | 223.2 MiB | 0.0 | 0, 0, 0, 0, 0, 0, 0 | +| A sample person starts or stops talking 10 times a second (`VOELIN_DEMO_TALK=10`) | 123.9 % (127 %) | 117.4 % | 3.6 % (6 %) | 227.9 MiB | 10.0 | 0, 0, 10.0, 10.0, 0, 10.0, 10.0 | + +60 samples each. The same two runs on the release build before the last three +small commits (`65b60f2`; Xvfb `:431` and `:432`, load average 25.3 before and 21.0 +after): idle 0.5 % (2 %), 220.2 MiB, no pane rendered; talking 109.9 % (122 %) in +all, `llvmpipe` 102.1 %, GPUI's thread 6.4 % (11 %), 226.3 MiB, 9.95 events and +frames a second, the sidebar, the tree, the members panel and the voice page +rendered 9.97 times a second each (59 samples: the loaded machine left a second +out). The software device's share moves with the machine's load (102 to 117 % +here); the thread's, which is the app's, did not. + +A window nobody touches is not drawn, with the voice page on screen as before. +Someone who starts or stops talking is one engine event, one frame and one render +of the sidebar (every frame renders it), the tree, the members panel and the voice +page, and none of the rail, the top bar and the main area; the model builds the +rows once for the three lists. The page's own cost is within the spread the load +of the machine makes (the tree slice's figures at the same rate were 102 to 106 % +in all and 3.1 to 5.0 % for GPUI's thread, 4.2 % on the minors round's); `llvmpipe` +draws the whole window again for every frame whichever pane asked for it, which is +the 90 ms of CPU a frame of this software device and what a GPU takes over. + +#### Seen against the servers + +Release build of `7140718`, the two development servers of +`dev/docker-compose.yml` used read-only (nothing created, deleted or reset; for +each, one connect of the app and one of a second client), a display of its own for +each run (Xvfb `:533` and `:534` of 3840 by 2160 with openbox, Mesa 26.2.5's +lavapipe, `llvmpipe (LLVM 21.1.8, 256 bits)` through Vulkan as the log's "Selected +GPU adapter" says, 1440 by 960), the state under the checkout's `.scratch/`, no +Wayland, no session bus, no XDG directory of the desktop, `ALSA_CONFIG_PATH` empty +(no sound card), driven with `xdotool` and read back with `xwd`. *TeamSpeak 3* +(3.13.8, `127.0.0.1:9987`): the form's Save and connect (the nickname `gpui-voice`) +shows the server page "Connected with voice", and ServerQuery's `clientlist -voice` +has the client in Default Channel; the Voice channel button opens the page with +one person; a second client, `voelinctl connect 127.0.0.1:9987 --nick +voelinctl-talker voice send --tone 440 --seconds 25`, joins and talks: the page +shows two people and the talker's ring, the bars in the corner of their avatar +and "Speaking" (the server's `client_flag_talking=1`, the page's marks from the +engine's `Talking` events), the same in the tree and the panel, which lead with +"In Voice — 2". The call bar's mute: the server says `client_input_muted=1`; +deafen: `client_output_muted=1` too; both clicked back: 0 and 0. Hold to talk held +with the pointer says "Talking…" and rings our avatar, as does `Ctrl+Shift+T` held +with `xdotool` (the log's line from the hotkey task: "Active: Ctrl+Shift+T +(X11)"); there is no microphone, so no audio goes out and the server's +`client_flag_talking` stays 0 for our client: the held key and button are seen in +the window, and the engine got `SetTransmitting`. The smaller stage, and the card +of the talker with the volume at 100 %. Leave: the page goes, and `clientlist` +does not have the client; Alt+F4 ended the app with exit status 0 and `clientlist` +after the close had no ghost of the app's client either. *TeamSpeak 6* +(6.0.0-beta13.1, `127.0.0.1:9988`), the same steps up to Leave (the smaller stage +and the card were not repeated) with Share in the call bar (the server can +stream: the click is logged) and no ServerQuery (it is SSH): the same page, marks, +hold, key and close, exit status 0; the pictures here are the TeamSpeak 3 run's. ### The theme @@ -1789,13 +2033,15 @@ Slint `Bridge` (`ui/bridge.slint:801-1206`; properties / callbacks): `toggle_collapse`, `search_members` and `open_member` as actions beside the shell's (`open_client` logged), and the password prompt the transitions ask for; -3. **next: the voice page and the call bar** (6 / 6): the people of our - channel (`TreeView::members`, built and not shown yet), `show_voice_view`, - the voice card's controls, the sidebar's server card with the banner behind - it (`server_banner`, which the tree slice left out: - [the table](#the-callbacks-and-the-properties)), and the release guard of - Hold to talk (below); -4. chat, the composer and emoji (about 19 / 18, and the `Emoji` global 3 / 3): +3. the **voice page and the call bar** (done, + [above](#the-voice-page-and-the-call-bar); 6 / 6): the people of our channel + (`TreeView::members`, through the tree model) with their marks, + `show_voice_view`, the call bar (mute, deafen, Share and the voice settings + logged, Leave) with the remembered smaller stage, the voice card's modes, the + volume of a person on the member card, the sidebar's server card with the banner + behind it (`server_banner`), the release guard of Hold to talk and the global + push-to-talk key on the engine's runtime; +4. **next:** chat, the composer and emoji (about 19 / 18, and the `Emoji` global 3 / 3): first the two open choices of the report that it touches (design/gpui-spikes.md, "Open choices for step 3"): emoji (the one-line `gpui-pre-wgpu` patch for colour emoji, or Noto Color Emoji bundled with a @@ -1832,7 +2078,10 @@ the slices that meet it; none of it is a defect of what exists today. its own and a signal of its own, embeds it cached as a sibling of the other panes (a cached view inside a view that renders again is rendered again), and raises its flag from `Signals::areas`. A new area is one more variant of - `signals::Area`. + `signals::Area`. The voice page (slice 3) is such a pane and needed no new area: + it watches the servers' and the toolbar's signals for its header and call bar, + takes its people from the model's `TreeEvent::Voice`, and `MainView` pushes + what no signal says (the stage chosen, the window too short) into it. - **No state change from a signal's observer, inside a flush.** The model listens to three signals (tree, toolbar, member card) and a batch raises several of them, so it may refresh twice in one flush of GPUI's effects, and @@ -1861,9 +2110,12 @@ the slices that meet it; none of it is a defect of what exists today. build: `a_picture_that_arrives_builds_the_rows_once`), but what a build costs is what a server of hundreds of people will pay for each event. A refresh that only flips `talking` of the rows it has (the talker's row, from the event's - client) or a reuse of the `ImageRef`s of the rows that did not change is the - voice page's (slice 3) or a later slice's, when a measurement on a large - server says it matters; the 9-person sample server does not. + client) or a reuse of the `ImageRef`s of the rows that did not change is still + a later slice's, when a measurement on a large server says it matters; the + 9-person sample server does not. The voice page (slice 3) did not need it: its + people are the third list of the same build (`TreeView::members`), not a + second build, and a talker is still one build for the tree, the panel and the + page ([what the voice page costs](#what-the-voice-page-costs)). - **The rail, the top bar and the main area refresh on the servers flag only.** Before the tree slice they compared what they would show with what they showed on every notify of the root; they listen to `Refresh::servers` now @@ -1898,9 +2150,11 @@ the slices that meet it; none of it is a defect of what exists today. What the caches save is the stream of engine events (a talker, a join), not the user's own clicks. - **The tree's and the panel's lists have no scrollbar and the panel no resize - handle**; the wheel scrolls (`gpui::ListState`), as the voice page's and the - chat's lists will have to as well, with gpui-component's scrollbar if it fits - a `ListState`, and `ui.members_width` is read at start. + handle**; the wheel scrolls (`gpui::ListState`), as the chat's list will have to + as well, with gpui-component's scrollbar if it fits a `ListState`, and + `ui.members_width` is read at start. The voice page's people scroll with the + wheel too (a plain scrolling container: down on the larger stage when the rows + outgrow the page, sideways on the smaller one) and have no scrollbar. - **Three copies stay in the Slint crate**, because `voelin-ui` is not edited beyond the identity helper in this round: `connect_into` and the two joins of `bind/servers.rs` (the shared ones are `sequence::join_channel`, @@ -1914,13 +2168,14 @@ the slices that meet it; none of it is a defect of what exists today. the GPUI front end alone, and Slint's copies can drift from them: a change to the rules of a join or of the card is made in both, or the Slint copy becomes the call first. -- **`SettingChanged` for the audio and the playback keys is not reloaded.** - `AppState::setting_changed` follows `ui.theme` and `ui.font_scale` only; the - Slint front end also reloads `audio` (unless the page has unsaved edits) and - `client_playback`, the crash-reports flag and the decoder keys. The values the - window keeps copies of (`vm.audio`, `vm.playback`) go stale when a command, - the config file or another window changes them; the settings slice (5) adds - the reload with the page that shows them. +- **`SettingChanged` is reloaded for the keys the voice page shows, not yet for + all of the Slint front end's.** `AppState::setting_changed` follows `ui.theme` + and `ui.font_scale`, and since the voice slice `audio` (unless the page has + unsaved edits: `audio_dirty`), `client_playback` and `ui.voice_compact`. The + Slint front end also reloads the crash-reports flag, the stream audio sources + and the decoder keys; and the `ui` value (the hotkey's `global_ptt` and + `ptt_key` are read at start only here); the settings slice (5) and the stream + slices add those with the pages and the parts that use them. - **Settled by the shell slice: the engine-event task and the tick.** The task takes what is queued (64 events at most) in one `update` with one `cx.notify()` and yields between steps, and the tick notifies nobody (the @@ -1948,11 +2203,15 @@ the slices that meet it; none of it is a defect of what exists today. field's `Escape`: with the field focused its Escape passes the key on and the binding closes the prompt, with anything else in the prompt focused the binding is the only one there. -- **The hotkey portal calls `tokio::spawn`** (`voelin-platform`, - `hotkey/portal.rs`, `PortalBackend::new`): it panics where no tokio runtime - is current, and a GPUI foreground task has none. The GPUI front end starts - the hotkey task on the engine's runtime (`runtime.spawn(...)`), as the Slint - front end's `GlobalPtt::start(runtime, ...)` does, not from a foreground task. +- **Settled by the voice slice: the hotkey runs on the engine's runtime.** The + hotkey portal calls `tokio::spawn` (`voelin-platform`, `hotkey/portal.rs`, + `PortalBackend::new`): it panics where no tokio runtime is current, and a GPUI + foreground task has none, so `hotkey.rs` spawns the task on the engine's + runtime, as the Slint front end's `GlobalPtt::start(runtime, ...)` does, and + `run()` starts it (`AppState::start_global_ptt`), never the state itself: a + test of the state with a real engine would ask the desktop for a shortcut. A + new part that talks to the desktop (a portal, a hotkey) is started by `run()` + and not by `AppState::new` for the same reason. - **`PortalCapture::stop` closes the portal session only inside a tokio runtime** (`voelin-media`, `capture/portal.rs`: `Handle::try_current()`; elsewhere the session closes only with the connection). Stop a capture inside @@ -2017,9 +2276,40 @@ the slices that meet it; none of it is a defect of what exists today. shell](#the-desktop-shell)). `run()` waits `CLOSE_GRACE` (500 ms) for the engine to send the closes only when the window's close found sessions to close. -- **Four risks of the shell the gate found by reading, left to the slices that +- **What the voice slice leaves to the slices that meet it.** + - *The chat's slice puts the way to the voice page where the chat is.* Today the + server page has the Voice channel button and the voice page's Chat only goes + back to it; with the chat, the button goes to the chat's header as in Slint + and the page's lower part is the channel's chat (the page says so where it + will be). `show_voice_view(true)` already opens the channel's chat tab in the + state (`open_chat`, with `focus`), whose reading marks wait for the front + end's answer to `Host::chat_shown` (`ShellHost` says `false` until a page + shows a chat), so the chat slice answers that from its own state. + - *The streams of the Slint page and the Share menu* are the stream slices': + the call bar's Share is logged (`OpenShare`) and shows when the server can + stream (`streams_available`), and the stream cards go between the people and + the call bar. + - *The person's volume writes `client_playback` at every step of a drag* (the + Slint card does too: `member_volume` stores each change). A settings page + that shows the volumes, or a profile that shows the writes, may want the + write on release (`SliderEvent::Release`) and the engine's command at every + step. The volume dialog the tree's click on a person asks for (`OpenClient`) + is still logged: the dialogs slice's. + - *The hotkey's key is read at start.* `AppState::set_global_ptt` is the entry + for the settings page that changes it, and the `ui` value is not reloaded on + `SettingChanged` (above). + - *A test of a pane that follows the window's height resizes the window first*: + GPUI's test platform has a window of 1024 by 768, which is under the 800 + pixels of the voice page's smaller stage (`voice_tests.rs`, `tall`). + - *Two X11 test binaries need an Xvfb with no window manager* (`voelin-media`'s + `x11_capture` and `voelin-platform`'s `x11`: CI has "xvfb only"): on + `spikes/gpui/headless.sh`'s display, with openbox, they fail (the first reads + the wrong pixels of its test window, the second hears no release of the key), + and they pass on the same display with `headless.sh -n`. +- **Three risks of the shell the gate found by reading, left to the slices that meet them** (none reproduced here, none is a defect of a path the shell's - tests exercise): + tests exercise; the fourth, Hold to talk staying on if voice drops while the + button is held, was settled by the voice slice, [above](#the-voice-page-and-the-call-bar)): - *The server on screen is not remembered across restarts.* `AppState::new` takes the first saved server (`bookmarks.first()`), whichever the user had on screen; the Slint app does the same and keeps only the last voice channel @@ -2029,12 +2319,6 @@ the slices that meet it; none of it is a defect of what exists today. without asking*, and what was typed in it is gone (`MainView::select_server` and `delete_server` drop `form`). The dialogs slice (9) turns the form into a dialog; it keeps the draft or asks. - - *Hold to talk stays on if voice drops while the button is held.* The voice - card, with the button, goes when voice leaves `Connected`, so the release - (`on_mouse_up`, `on_mouse_up_out`) has no element to land on: `Sidebar` - keeps `holding` and the session keeps `transmitting` until the next press. - Releasing on the window, or clearing the flag when voice drops, belongs - with the voice page (slice 3). - *A tiling compositor's tile is stored as the window size* (and, on X11 under a tiling window manager, as its position): `ui.window` takes what the window reports without asking whether it is tiled or floating, so the next diff --git a/docs/ui/gpui-voice-card-dark.png b/docs/ui/gpui-voice-card-dark.png new file mode 100644 index 0000000..23c869c Binary files /dev/null and b/docs/ui/gpui-voice-card-dark.png differ diff --git a/docs/ui/gpui-voice-compact-dark.png b/docs/ui/gpui-voice-compact-dark.png new file mode 100644 index 0000000..34a578d Binary files /dev/null and b/docs/ui/gpui-voice-compact-dark.png differ diff --git a/docs/ui/gpui-voice-compact-light.png b/docs/ui/gpui-voice-compact-light.png new file mode 100644 index 0000000..fa43e8b Binary files /dev/null and b/docs/ui/gpui-voice-compact-light.png differ diff --git a/docs/ui/gpui-voice-dark.png b/docs/ui/gpui-voice-dark.png new file mode 100644 index 0000000..171ed9d Binary files /dev/null and b/docs/ui/gpui-voice-dark.png differ diff --git a/docs/ui/gpui-voice-light.png b/docs/ui/gpui-voice-light.png new file mode 100644 index 0000000..8cb289b Binary files /dev/null and b/docs/ui/gpui-voice-light.png differ diff --git a/docs/ui/gpui-voice-live-dark.png b/docs/ui/gpui-voice-live-dark.png new file mode 100644 index 0000000..bbb48d9 Binary files /dev/null and b/docs/ui/gpui-voice-live-dark.png differ