From 460024f72379061cd8dadd69613dd2d2b7024697 Mon Sep 17 00:00:00 2001 From: selikhov Date: Sat, 3 Oct 2026 07:46:27 +0300 Subject: [PATCH] voelin-ui: keep the studio to one stream and one window where needed A session has one stream of ours: a quick share now refuses to start where the studio is live, as Go Live already refused where a share runs. Android runs one window, so the studio cannot be detached there (a wide tablet shows the desktop layout and its detach button). The studio's window sets the standard widgets' colour scheme from its theme, as the main window does, and the dialogs keep their fields under their labels. Headless screenshots also drop XDG_SESSION_TYPE: with it the push-to-talk hotkey (and screen capture) pick the desktop portal of the user's Wayland session even on Xvfb, which can ask the real desktop to bind a shortcut. Co-Authored-By: Claude Opus 5.5 --- crates/voelin-ui/src/streams.rs | 5 +++++ crates/voelin-ui/src/studio.rs | 5 +++++ crates/voelin-ui/ui/screens/studio-parts.slint | 7 +++++-- crates/voelin-ui/ui/studio-bridge.slint | 2 ++ crates/voelin-ui/ui/studio-window.slint | 7 +++++++ scripts/shots.sh | 6 ++++-- 6 files changed, 28 insertions(+), 4 deletions(-) diff --git a/crates/voelin-ui/src/streams.rs b/crates/voelin-ui/src/streams.rs index 1941fee..013e608 100644 --- a/crates/voelin-ui/src/streams.rs +++ b/crates/voelin-ui/src/streams.rs @@ -474,6 +474,11 @@ impl App { if self.share_busy || self.share.is_some() { return; } + if self.studio_streams_to(session) { + self.share_error = "The Stream Studio is live here: end that stream first.".into(); + self.refresh_streams(); + return; + } // Typed values (no maximum), else the chosen presets. let choice = |i: i32, choices: &[u32]| { choices[usize::try_from(i).unwrap_or(0).min(choices.len() - 1)] diff --git a/crates/voelin-ui/src/studio.rs b/crates/voelin-ui/src/studio.rs index d550fc2..607bb5d 100644 --- a/crates/voelin-ui/src/studio.rs +++ b/crates/voelin-ui/src/studio.rs @@ -1007,6 +1007,7 @@ impl App { output_height: h as i32, fps: fps as i32, detached: st.window.is_some(), + can_detach: cfg!(not(target_os = "android")), screen_shown: shows(|k| { matches!( k, @@ -1899,6 +1900,10 @@ impl App { // The window of its own. pub(crate) fn studio_detach(&mut self) { + // One window on Android. + if cfg!(target_os = "android") { + return; + } if self.studio.window.is_none() { let window = match StudioWindow::new() { Ok(window) => window, diff --git a/crates/voelin-ui/ui/screens/studio-parts.slint b/crates/voelin-ui/ui/screens/studio-parts.slint index c59548e..0345a98 100644 --- a/crates/voelin-ui/ui/screens/studio-parts.slint +++ b/crates/voelin-ui/ui/screens/studio-parts.slint @@ -717,7 +717,7 @@ export component StudioHeader inherits HorizontalLayout { } } } - IconButton { + if StudioBridge.status.can-detach: IconButton { icon: StudioBridge.status.detached ? Icons.minimize-2 : Icons.external-link; label: StudioBridge.status.detached ? @tr("Back into the main window") : @tr("Open in its own window"); y: (parent.height - self.height) / 2; @@ -1697,6 +1697,7 @@ component NumberField inherits VerticalLayout { in property label; in-out property value <=> field.text; in property placeholder; + alignment: start; spacing: Theme.space-1; Text { text: root.label; @@ -1720,11 +1721,12 @@ component SourceDialog inherits Modal { subtitle: adding ? @tr("Added to the live scene.") : @tr("Position, size and crop are in output pixels."); icon: StudioKinds.icon(form.kind); card-width: 560px; - card-height: 680px; + card-height: form.kind == "camera" ? 760px : form.kind == "text" || form.kind == "colour" || form.kind == "image" ? 640px : 560px; dismissed => { done(); } ScrollView { vertical-stretch: 1; VerticalLayout { + alignment: start; spacing: Theme.space-4; padding-right: Theme.space-3; Field { @@ -2042,6 +2044,7 @@ component StudioSettingsDialog inherits Modal { ScrollView { vertical-stretch: 1; VerticalLayout { + alignment: start; spacing: Theme.space-4; padding-right: Theme.space-3; Field { diff --git a/crates/voelin-ui/ui/studio-bridge.slint b/crates/voelin-ui/ui/studio-bridge.slint index bc7bcbd..b319cd4 100644 --- a/crates/voelin-ui/ui/studio-bridge.slint +++ b/crates/voelin-ui/ui/studio-bridge.slint @@ -112,6 +112,8 @@ export struct StudioStatus { output-height: int, fps: int, detached: bool, + // A window of its own is possible (not on Android). + can-detach: bool, // The live scene shows a screen, a camera, a window (the phone's cards). screen-shown: bool, camera-shown: bool, diff --git a/crates/voelin-ui/ui/studio-window.slint b/crates/voelin-ui/ui/studio-window.slint index b70319e..458b4ab 100644 --- a/crates/voelin-ui/ui/studio-window.slint +++ b/crates/voelin-ui/ui/studio-window.slint @@ -3,6 +3,7 @@ // compact; it has its own globals, which Rust fills from the same models // (src/studio.rs). Closing it docks the studio back into the main window. +import { Palette } from "std-widgets.slint"; import { Theme } from "theme.slint"; import { Icons } from "icons.slint"; import { StudioBridge, StudioNav } from "studio-bridge.slint"; @@ -20,6 +21,12 @@ export component StudioWindow inherits Window { default-font-size: Theme.font-body; icon: Icons.logo; + // Scroll bars and menus follow the theme (Rust copies the main + // window's Theme here). + property dark: Theme.dark; + changed dark => { Palette.color-scheme = Theme.dark ? ColorScheme.dark : ColorScheme.light; } + init => { Palette.color-scheme = Theme.dark ? ColorScheme.dark : ColorScheme.light; } + Rectangle { background: Theme.backdrop; VerticalLayout { diff --git a/scripts/shots.sh b/scripts/shots.sh index 3308569..2a80b9a 100755 --- a/scripts/shots.sh +++ b/scripts/shots.sh @@ -7,7 +7,9 @@ # colours with `convert -colors 256 PNG8:`). # # WAYLAND_DISPLAY is removed so the window opens on the Xvfb server and not -# on the desktop of a Wayland session (winit prefers Wayland when it can). +# on the desktop of a Wayland session (winit prefers Wayland when it can), +# and XDG_SESSION_TYPE so nothing picks the desktop portal for a Wayland +# session (the push-to-talk hotkey would ask the desktop to bind it). # The screen is twice the window's size, so the pointer (in its middle) is # not over the window and nothing shows as hovered. FFmpeg stays off: the # pictures need no hardware encoders, and probing them can crash in some @@ -19,7 +21,7 @@ size=${3:-1440x960} w=${size%x*} h=${size#*x} bin=${VOELIN_BIN:-$CARGO_TARGET_DIR/debug/voelin} -env -u WAYLAND_DISPLAY \ +env -u WAYLAND_DISPLAY -u XDG_SESSION_TYPE \ SLINT_BACKEND=winit-software \ VOELIN_FFMPEG=0 \ VOELIN_DATA_DIR="$(mktemp -d)" \