forge
Explore
Log in

Don't you dare go Hollow

Stage tiles 16:9 with label pills (kind colour, user colour, voice spectrum, muted mic), focus viewer gets label + live stats HUD and a floating control bar

Browse files at this commit

4a0183206f65d11f76b05b8eeee23faae9787ee1Ahmet Kaan GümüşParent: 492d84d
  • ui
    • stage tiles 16:9 with label pills (kind colour, user colour, voice spectrum, muted mic), focus viewer gets label + live stats HUD and a floating control bar
    • harness/usage.sh measures cpu/gpu/memory/disk per client
Show full message
💄 ui: stage tiles 16:9 with label pills (kind colour, user colour, voice spectrum, muted mic), focus viewer gets label + live stats HUD and a floating control bar; harness/usage.sh measures cpu/gpu/memory/disk per client
crates/client/src/gui/camera_view.rsmodified+74 -41
@@ -2,8 +2,9 @@ use common::model::Id;
2 2
3 use common::share::{Fps, Kind, Quality, Resolution};3 use common::share::{Fps, Kind, Quality, Resolution};
4 use gpui_kit::{4 use gpui_kit::{
5- AnyElement, AppContext as _, Context, Entity, InteractiveElement, IntoElement, ParentElement,5+ AnyElement, AppContext as _, Context, Div, Entity, FontWeight, InteractiveElement, IntoElement,
6- StatefulInteractiveElement, Styled, Task, Window, component::Icon, div, px,6+ ParentElement, StatefulInteractiveElement, Styled, Task, Window, assets::IconName,
7+ component::Icon, div, px,
7 };8 };
8 9
9 use super::{10 use super::{
@@ -13,6 +14,7 @@ use super::{
13 share_view::{self, FRAME_TICK},14 share_view::{self, FRAME_TICK},
14 surface::Surface,15 surface::Surface,
15 text,16 text,
17+ wave::mini_wave,
16 widget::spawn_warn,18 widget::spawn_warn,
17 };19 };
18 use crate::share::session::WatchQuality;20 use crate::share::session::WatchQuality;
@@ -214,9 +216,10 @@ impl Yumush {
214 .id("stage_strip")216 .id("stage_strip")
215 .flex()217 .flex()
216 .flex_shrink_0()218 .flex_shrink_0()
217- .h(px(108.))219+ .h(px(206.))
218- .gap(px(6.))220+ .gap(px(8.))
219- .p(px(6.))221+ .p(px(8.))
222+ .bg(palette.window)
220 .overflow_x_scroll()223 .overflow_x_scroll()
221 .border_b_1()224 .border_b_1()
222 .border_color(palette.border)225 .border_color(palette.border)
@@ -266,6 +269,7 @@ impl Yumush {
266 .flex_1()269 .flex_1()
267 .min_h_0()270 .min_h_0()
268 .p(px(8.))271 .p(px(8.))
272+ .bg(palette.window)
269 .flex()273 .flex()
270 .flex_col()274 .flex_col()
271 .gap(px(8.))275 .gap(px(8.))
@@ -312,7 +316,6 @@ fn stage_tile(
312 .filter(|tile| tile.shown)316 .filter(|tile| tile.shown)
313 .map(|tile| tile.surface.clone());317 .map(|tile| tile.surface.clone());
314 let user = yumush.chat.author(user_id);318 let user = yumush.chat.author(user_id);
315- let name = user.map_or("Someone", |user| user.username.as_str());
316 let content = match (surface, user) {319 let content = match (surface, user) {
317 (Some(surface), _) => surface.into_any_element(),320 (Some(surface), _) => surface.into_any_element(),
318 (None, Some(user)) => div()321 (None, Some(user)) => div()
@@ -323,8 +326,8 @@ fn stage_tile(
323 .child(avatar(326 .child(avatar(
324 palette,327 palette,
325 user,328 user,
326- px(36.),329+ px(56.),
327- text(14.),330+ text(20.),
328 &yumush.chat.avatars,331 &yumush.chat.avatars,
329 ))332 ))
330 .into_any_element(),333 .into_any_element(),
@@ -343,9 +346,9 @@ fn stage_tile(
343 .tip("Watch")346 .tip("Watch")
344 .relative()347 .relative()
345 .flex_shrink_0()348 .flex_shrink_0()
346- .w(px(171.))349+ .w(px(338.))
347- .h(px(96.))350+ .h(px(190.))
348- .rounded(px(8.))351+ .rounded(px(10.))
349 .overflow_hidden()352 .overflow_hidden()
350 .bg(gpui_kit::black())353 .bg(gpui_kit::black())
351 .border_2()354 .border_2()
@@ -358,20 +361,10 @@ fn stage_tile(
358 })361 })
359 .child(content)362 .child(content)
360 .child(363 .child(
361- div()364+ tile_label(yumush, palette, (user_id, kind))
362 .absolute()365 .absolute()
363- .left(px(6.))366+ .left(px(8.))
364- .bottom(px(6.))367+ .bottom(px(8.)),
365- .px(px(6.))
366- .py(px(2.))
367- .rounded(px(4.))
368- .bg(palette.panel)
369- .text_size(text(11.))
370- .flex()
371- .items_center()
372- .gap(px(4.))
373- .child(Icon::new(share_view::kind_icon(kind)).w(px(12.)).h(px(12.)))
374- .child(name.to_string()),
375 )368 )
376 }369 }
377 370
@@ -390,7 +383,6 @@ fn grid_cell(
390 .map(|tile| tile.surface.clone());383 .map(|tile| tile.surface.clone());
391 let speaking = yumush.chat.waves.speaking.contains(&user_id);384 let speaking = yumush.chat.waves.speaking.contains(&user_id);
392 let user = yumush.chat.author(user_id);385 let user = yumush.chat.author(user_id);
393- let name = user.map_or("Someone", |user| user.username.as_str());
394 let content = match (surface, user) {386 let content = match (surface, user) {
395 (Some(surface), _) => surface.into_any_element(),387 (Some(surface), _) => surface.into_any_element(),
396 (None, Some(user)) => div()388 (None, Some(user)) => div()
@@ -426,23 +418,10 @@ fn grid_cell(
426 })418 })
427 .child(content)419 .child(content)
428 .child(420 .child(
429- div()421+ tile_label(yumush, palette, (user_id, kind))
430 .absolute()422 .absolute()
431- .left(px(6.))423+ .left(px(8.))
432- .bottom(px(6.))424+ .bottom(px(8.)),
433- .px(px(6.))
434- .py(px(2.))
435- .rounded(px(4.))
436- .bg(palette.panel)
437- .text_size(text(11.))
438- .flex()
439- .items_center()
440- .gap(px(4.))
441- .children(
442- (kind == Kind::Screen)
443- .then(|| Icon::new(share_view::kind_icon(kind)).w(px(12.)).h(px(12.))),
444- )
445- .child(name.to_string()),
446 );425 );
447 426
448 if shared {427 if shared {
@@ -458,3 +437,57 @@ fn grid_cell(
458 cell.into_any_element()437 cell.into_any_element()
459 }438 }
460 }439 }
440+
441+pub(super) fn tile_label(yumush: &Yumush, palette: Palette, (user_id, kind): (Id, Kind)) -> Div {
442+ let tone = match kind {
443+ Kind::Screen => palette.screen,
444+ Kind::Camera => palette.camera,
445+ };
446+ let name = yumush
447+ .chat
448+ .author(user_id)
449+ .map_or("Someone", |user| user.username.as_str());
450+ let wave = yumush
451+ .chat
452+ .waves
453+ .speaking
454+ .contains(&user_id)
455+ .then(|| yumush.chat.waves.voice(user_id))
456+ .flatten();
457+ let shared = yumush
458+ .chat
459+ .voice_community()
460+ .and_then(|community_id| yumush.chat.share_of(community_id, user_id, kind))
461+ .is_some();
462+ let muted = yumush.chat.server_muted.contains(&user_id)
463+ || (yumush.is_me(user_id) && yumush.chat.voice_flags().is_some_and(|(muted, _)| muted));
464+
465+ div()
466+ .h(px(24.))
467+ .px(px(8.))
468+ .rounded(px(12.))
469+ .bg(gpui_kit::black().opacity(0.72))
470+ .flex()
471+ .items_center()
472+ .gap(px(6.))
473+ .text_size(text(12.))
474+ .children(shared.then(|| {
475+ Icon::new(share_view::kind_icon(kind))
476+ .w(px(13.))
477+ .h(px(13.))
478+ .text_color(tone)
479+ }))
480+ .child(
481+ div()
482+ .font_weight(FontWeight::SEMIBOLD)
483+ .text_color(palette.tinted(user_id))
484+ .child(name.to_string()),
485+ )
486+ .children(wave.map(|history| mini_wave(history, 10., palette.ok)))
487+ .children((muted && wave.is_none()).then(|| {
488+ Icon::new(IconName::MicOff)
489+ .w(px(12.))
490+ .h(px(12.))
491+ .text_color(palette.danger)
492+ }))
493+}
crates/client/src/gui/chat.rsmodified+3 -3
@@ -3053,12 +3053,12 @@ fn stage_button(
3053 }),3053 }),
3054 )3054 )
3055 .tip(if active { "Hide" } else { name })3055 .tip(if active { "Hide" } else { name })
3056- .size(px(22.))3056+ .size(px(26.))
3057 .flex()3057 .flex()
3058 .items_center()3058 .items_center()
3059 .justify_center()3059 .justify_center()
3060- .rounded(px(4.))3060+ .rounded(px(6.))
3061- .when(active, |this| this.bg(palette.hover))3061+ .when(active, |this| this.bg(palette.accent.opacity(0.13)))
3062 .text_color(if active {3062 .text_color(if active {
3063 palette.accent3063 palette.accent
3064 } else {3064 } else {
crates/client/src/gui/share_view.rsmodified+101 -52
@@ -461,10 +461,35 @@ impl Yumush {
461 (IconName::Maximize, "Fullscreen")461 (IconName::Maximize, "Fullscreen")
462 };462 };
463 let audio = viewer.kind == Kind::Screen;463 let audio = viewer.kind == Kind::Screen;
464- let name = self464+ let tone = match viewer.kind {
465+ Kind::Screen => palette.screen,
466+ Kind::Camera => palette.camera,
467+ };
468+ let hud = self
465 .chat469 .chat
466- .author(viewer.user_id)470+ .share_sample
467- .map_or("Someone", |user| user.username.as_str());471+ .watching
472+ .iter()
473+ .find(|(user_id, kind, _)| *user_id == viewer.user_id && *kind == viewer.kind)
474+ .map(|(_, _, stats)| {
475+ let quality = stats.layer.as_ref().map_or("…".to_string(), |layer| {
476+ format!(
477+ "{}p{}",
478+ layer.quality.resolution.height(),
479+ layer.quality.fps.value()
480+ )
481+ });
482+ let loss = if stats.loss * 100. > 0.5 {
483+ format!(" · {:.1}% loss", stats.loss * 100.)
484+ } else {
485+ String::new()
486+ };
487+ format!(
488+ "{quality} · {:.1} Mb · {:.0} fps{loss}",
489+ stats.kbps as f32 / 1000.,
490+ stats.fps
491+ )
492+ });
468 493
469 div()494 div()
470 .flex_1()495 .flex_1()
@@ -483,63 +508,87 @@ impl Yumush {
483 })508 })
484 .when(viewer.shown, |video| video.child(viewer.surface.clone())),509 .when(viewer.shown, |video| video.child(viewer.surface.clone())),
485 )510 )
511+ .child(
512+ camera_view::tile_label(self, palette, (viewer.user_id, viewer.kind))
513+ .absolute()
514+ .left(px(10.))
515+ .top(px(10.)),
516+ )
517+ .children(hud.map(|hud| {
518+ div()
519+ .absolute()
520+ .right(px(10.))
521+ .top(px(10.))
522+ .h(px(24.))
523+ .px(px(8.))
524+ .flex()
525+ .items_center()
526+ .rounded(px(12.))
527+ .bg(gpui_kit::black().opacity(0.72))
528+ .text_size(text(11.))
529+ .text_color(tone)
530+ .child(hud)
531+ }))
486 .child(532 .child(
487 div()533 div()
488 .absolute()534 .absolute()
489 .left_0()535 .left_0()
490 .right_0()536 .right_0()
491- .bottom_0()537+ .bottom(px(12.))
492- .h(px(44.))
493- .on_mouse_up(MouseButton::Left, |_, _, cx| cx.stop_propagation())
494- .px(px(12.))
495 .flex()538 .flex()
496- .items_center()539+ .justify_center()
497- .gap(px(8.))540+ .on_mouse_up(MouseButton::Left, |_, _, cx| cx.stop_propagation())
498- .bg(gpui_kit::black().opacity(0.55))
499 .opacity(0.)541 .opacity(0.)
500 .group_hover("viewer", |style| style.opacity(1.))542 .group_hover("viewer", |style| style.opacity(1.))
501- .text_size(text(12.))543+ .child(
502- .text_color(palette.text)544+ div()
503- .child(Icon::new(kind_icon(viewer.kind)).w(px(14.)).h(px(14.)))545+ .h(px(38.))
504- .child(name.to_string())546+ .px(px(4.))
505- .child(div().flex_1())547+ .flex()
506- .children(audio.then(|| {548+ .items_center()
507- let muted = self.settings.share.volume == 0.;549+ .gap(px(4.))
508- icon_button(550+ .rounded(px(10.))
509- format!("share_mute_{muted}"),551+ .bg(gpui_kit::black().opacity(0.85))
510- palette,552+ .border_1()
511- if muted {553+ .border_color(palette.border)
512- IconName::VolumeX554+ .children(audio.then(|| {
513- } else {555+ let muted = self.settings.share.volume == 0.;
514- IconName::Volume2556+ icon_button(
515- },557+ format!("share_mute_{muted}"),
516- if muted { "Unmute" } else { "Mute" },558+ palette,
517- entity_action(entity, |yumush, window, cx| {559+ if muted {
518- yumush.toggle_share_mute(window, cx)560+ IconName::VolumeX
519- }),561+ } else {
520- )562+ IconName::Volume2
521- }))563+ },
522- .children(audio.then(|| {564+ if muted { "Unmute" } else { "Mute" },
523- div().w(px(80.)).child(565+ entity_action(entity, |yumush, window, cx| {
524- Slider::new(&viewer.volume)566+ yumush.toggle_share_mute(window, cx)
525- .bg(palette.accent)567+ }),
526- .text_color(palette.text),568+ )
527- )569+ }))
528- }))570+ .children(audio.then(|| {
529- .child(icon_button(571+ div().w(px(80.)).child(
530- format!("share_fullscreen_{}", viewer.fullscreen),572+ Slider::new(&viewer.volume)
531- palette,573+ .bg(palette.screen)
532- fullscreen_icon,574+ .text_color(palette.text),
533- fullscreen_tip,575+ )
534- entity_action(entity, |yumush, _, cx| yumush.toggle_fullscreen(cx)),576+ }))
535- ))577+ .child(icon_button(
536- .child(icon_button(578+ format!("share_fullscreen_{}", viewer.fullscreen),
537- "share_close".to_string(),579+ palette,
538- palette,580+ fullscreen_icon,
539- IconName::X,581+ fullscreen_tip,
540- "Close",582+ entity_action(entity, |yumush, _, cx| yumush.toggle_fullscreen(cx)),
541- entity_action(entity, |yumush, _, cx| yumush.close_viewer(cx)),583+ ))
542- )),584+ .child(icon_button(
585+ "share_close".to_string(),
586+ palette,
587+ IconName::X,
588+ "Close",
589+ entity_action(entity, |yumush, _, cx| yumush.close_viewer(cx)),
590+ )),
591+ ),
543 )592 )
544 }593 }
545 }594 }
harness/usage.shadded+15 -0
@@ -0,0 +1,15 @@
1+#!/usr/bin/env bash
2+set -euo pipefail
3+STATE="${HARNESS_STATE:-/tmp/claude-1000/yumush-harness}"
4+NAME="${1:-alice}"
5+SPAN="${SPAN:-10}"
6+PID=$(awk -v n="$NAME" '$1 == n {print $2}' "$STATE/pids" | tail -1)
7+ticks() { awk '{print $14 + $15}' "/proc/$PID/stat"; }
8+engine() { cat /proc/"$PID"/fdinfo/* 2>/dev/null | awk -v e="drm-engine-$1:" '$1 == e {s += $2} END {print s + 0}'; }
9+memory() { cat /proc/"$PID"/fdinfo/* 2>/dev/null | awk -v m="drm-memory-$1:" '$1 == m {s += $2} END {print s + 0}'; }
10+kib() { awk -v k="$1:" '$1 == k {print $2}' "/proc/$PID/smaps_rollup"; }
11+t=$(ticks); g=$(engine gfx); e=$(engine enc); d=$(engine dec)
12+sleep "$SPAN"
13+T=$(ticks); G=$(engine gfx); E=$(engine enc); D=$(engine dec)
14+pct() { awk -v a="$1" -v b="$2" -v s="$SPAN" "BEGIN {printf \"%.1f\", (b - a) / s / $3}"; }
15+echo "$NAME cpu $(pct "$t" "$T" 1)% gfx $(pct "$g" "$G" 1e7)% enc $(pct "$e" "$E" 1e7)% dec $(pct "$d" "$D" 1e7)% pss $(( $(kib Pss) / 1024 ))M rss $(( $(kib Rss) / 1024 ))M vram $(( $(memory vram) / 1024 ))M gtt $(( $(memory gtt) / 1024 ))M threads $(awk '/^Threads/ {print $2}' "/proc/$PID/status") disk $(du -sh "$STATE/clients/$NAME" | cut -f1)"