From 0a4fc34face66836d93277a8f602f2e1df44d1a4 Mon Sep 17 00:00:00 2001 From: Aleksander Date: Thu, 26 Mar 2026 22:15:05 +0100 Subject: [PATCH] dash-interface: fetch client IDs, toggle filter --- Cargo.lock | 6 ------ dash-frontend/src/tab/monado.rs | 21 ++++++++++++++------- wayvr/src/overlays/dashboard.rs | 10 +++++++++- wlx-common/src/dash_interface.rs | 3 ++- wlx-common/src/dash_interface_emulated.rs | 9 ++++++++- 5 files changed, 33 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4372aafe..18302e7a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2795,12 +2795,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - [[package]] name = "lebe" version = "0.5.3" diff --git a/dash-frontend/src/tab/monado.rs b/dash-frontend/src/tab/monado.rs index 5215e784..c65861b9 100644 --- a/dash-frontend/src/tab/monado.rs +++ b/dash-frontend/src/tab/monado.rs @@ -71,6 +71,7 @@ struct DebugGraph { } struct DebugSessionList { + #[allow(dead_code)] buttons: Vec>, #[allow(dead_code)] data_vec: Vec, @@ -112,6 +113,7 @@ struct SubtabDebugTimings { } #[allow(dead_code)] +#[allow(clippy::large_enum_variant)] enum Subtab { Empty, GeneralSettings(SubtabGeneralSettings), @@ -196,7 +198,7 @@ impl Tab for TabMonado { } } Subtab::DebugTimings(timings) => { - timings.update(&self.tasks, data, frontend); + timings.update(&self.tasks, data, frontend)?; } } @@ -427,14 +429,14 @@ impl SubtabDebugTimings { Ok(()) } - fn update(&mut self, tasks: &Tasks, data: &mut T, frontend: &mut Frontend) { + fn update(&mut self, tasks: &Tasks, data: &mut T, frontend: &mut Frontend) -> anyhow::Result<()> { if !frontend.interface.monado_metrics_set_enabled(data, true) { - return; + return Ok(()); } let frames = frontend.interface.monado_metrics_dump_session_frames(data); if frames.is_empty() { - return; + return Ok(()); } let col_green = Color::new(0.0, 1.0, 0.0, 1.0); @@ -525,7 +527,7 @@ impl SubtabDebugTimings { frame.session_id, TimingsSession { last_frame: frame, - resolved_name: None, + resolved_name: None, /* TODO! find client ID from session ID */ }, ); tasks.push(Task::DebugTimingsRefreshSessionList); @@ -534,6 +536,8 @@ impl SubtabDebugTimings { } frontend.layout.mark_redraw(); + + Ok(()) } } @@ -568,7 +572,10 @@ impl SubtabProcessList { Rc::from("0") }, ); - par.insert("name".into(), client.name.clone().into()); + par.insert( + "name".into(), + format!("{} (Client ID: {})", client.name, client.id).into(), + ); par.insert("flag_active".into(), yesno(client.is_active).into()); par.insert("flag_focused".into(), yesno(client.is_focused).into()); par.insert("flag_io_active".into(), yesno(client.is_io_active).into()); @@ -618,7 +625,7 @@ impl SubtabProcessList { fn refresh(&mut self, frontend: &mut Frontend, data: &mut T, tasks: &Tasks) -> anyhow::Result<()> { log::debug!("refreshing monado client list"); - let clients = frontend.interface.monado_client_list(data)?; + let clients = frontend.interface.monado_client_list(data, true)?; frontend.layout.remove_children(self.id_list_parent); self.cells.clear(); diff --git a/wayvr/src/overlays/dashboard.rs b/wayvr/src/overlays/dashboard.rs index 1db82735..f36e0558 100644 --- a/wayvr/src/overlays/dashboard.rs +++ b/wayvr/src/overlays/dashboard.rs @@ -470,20 +470,27 @@ impl DashInterface for DashInterfaceLive { fn monado_client_list( &mut self, app: &mut AppState, + filtered: bool, ) -> anyhow::Result> { let Some(monado) = &mut app.monado_state else { return Ok(Vec::new()); // no monado available }; - let clients = monado_list_clients_filtered(&mut monado.ipc)?; + let clients = if filtered { + monado_list_clients_filtered(&mut monado.ipc)? + } else { + monado.ipc.clients()?.into_iter().collect() + }; let mut res = Vec::::new(); for mut client in clients { + let client_id = client.id(); let name = client.name()?; let state = client.state()?; res.push(dash_interface::MonadoClient { + id: client_id as i64, name, is_primary: state.contains(libmonado::ClientState::ClientPrimaryApp), is_active: state.contains(libmonado::ClientState::ClientSessionActive), @@ -592,6 +599,7 @@ impl DashInterface for DashInterfaceLive { fn monado_client_list( &mut self, _: &mut AppState, + _filtered: bool, ) -> anyhow::Result> { anyhow::bail!("Not supported in this build.") } diff --git a/wlx-common/src/dash_interface.rs b/wlx-common/src/dash_interface.rs index 424ed2b2..7f80d557 100644 --- a/wlx-common/src/dash_interface.rs +++ b/wlx-common/src/dash_interface.rs @@ -7,6 +7,7 @@ use crate::{config::GeneralConfig, desktop_finder::DesktopFinder}; #[derive(Clone)] pub struct MonadoClient { + pub id: i64, pub name: String, pub is_primary: bool, pub is_active: bool, @@ -55,7 +56,7 @@ pub trait DashInterface { ) -> anyhow::Result; fn process_list(&mut self, data: &mut T) -> anyhow::Result>; fn process_terminate(&mut self, data: &mut T, handle: WvrProcessHandle) -> anyhow::Result<()>; - fn monado_client_list(&mut self, data: &mut T) -> anyhow::Result>; + fn monado_client_list(&mut self, data: &mut T, filtered: bool) -> anyhow::Result>; fn monado_client_focus(&mut self, data: &mut T, name: &str) -> anyhow::Result<()>; fn monado_brightness_get(&mut self, data: &mut T) -> Option; fn monado_brightness_set(&mut self, data: &mut T, brightness: f32) -> Option<()>; diff --git a/wlx-common/src/dash_interface_emulated.rs b/wlx-common/src/dash_interface_emulated.rs index 49b0dd7e..3526de94 100644 --- a/wlx-common/src/dash_interface_emulated.rs +++ b/wlx-common/src/dash_interface_emulated.rs @@ -88,6 +88,7 @@ impl DashInterfaceEmulated { let monado_clients = vec![ dash_interface::MonadoClient { + id: 1, name: String::from("The Best VR Game 3000"), is_active: true, is_focused: true, @@ -97,6 +98,7 @@ impl DashInterfaceEmulated { is_visible: true, }, dash_interface::MonadoClient { + id: 2, name: String::from("Second app"), is_active: true, is_focused: false, @@ -106,6 +108,7 @@ impl DashInterfaceEmulated { is_visible: true, }, dash_interface::MonadoClient { + id: 3, name: String::from("Third app"), is_active: true, is_focused: false, @@ -233,7 +236,11 @@ impl DashInterface<()> for DashInterfaceEmulated { fn toggle_dashboard(&mut self, _data: &mut ()) {} - fn monado_client_list(&mut self, _data: &mut ()) -> anyhow::Result> { + fn monado_client_list( + &mut self, + _data: &mut (), + _filtered: bool, + ) -> anyhow::Result> { Ok(self.monado_clients.clone()) }