diff --git a/dash-frontend/src/tab/monado.rs b/dash-frontend/src/tab/monado.rs index cac91366..28d8b074 100644 --- a/dash-frontend/src/tab/monado.rs +++ b/dash-frontend/src/tab/monado.rs @@ -51,7 +51,7 @@ enum Task { // `ProcessList` tab ProcessListRefresh, - ProcessListFocusClient(String), + ProcessListFocusClient(i64), // `DebugTimings` tab DebugTimingsRefreshSessionList, @@ -157,9 +157,9 @@ impl Tab for TabMonado { process_list.refresh(frontend, data, &self.tasks)?; } } - Task::ProcessListFocusClient(client_name) => { + Task::ProcessListFocusClient(client_id) => { if let Subtab::ProcessList(process_list) = &mut self.subtab { - process_list.focus_client(frontend, data, client_name, &self.tasks)?; + process_list.focus_client(frontend, data, client_id, &self.tasks)?; } } Task::DebugTimingsRefreshSessionList => { @@ -676,10 +676,10 @@ impl SubtabProcessList { let checkbox = state_cell.fetch_component_as::("checkbox")?; checkbox.on_toggle({ let tasks = tasks.clone(); - let client_name = client.name.clone(); + let client_id = client.id; Box::new(move |_common, e| { if e.checked { - tasks.push(Task::ProcessListFocusClient(client_name.clone())); + tasks.push(Task::ProcessListFocusClient(client_id)); } Ok(()) }) @@ -694,10 +694,10 @@ impl SubtabProcessList { &mut self, frontend: &mut Frontend, data: &mut T, - name: String, + client_id: i64, tasks: &Tasks, ) -> anyhow::Result<()> { - frontend.interface.monado_client_focus(data, &name)?; + frontend.interface.monado_client_focus(data, client_id)?; tasks.push(Task::ProcessListRefresh); Ok(()) } diff --git a/wayvr/src/overlays/dashboard.rs b/wayvr/src/overlays/dashboard.rs index 84577399..b0a2334b 100644 --- a/wayvr/src/overlays/dashboard.rs +++ b/wayvr/src/overlays/dashboard.rs @@ -620,12 +620,12 @@ impl DashInterface for DashInterfaceLive { } #[cfg(feature = "openxr")] - fn monado_client_focus(&mut self, app: &mut AppState, name: &str) -> anyhow::Result<()> { + fn monado_client_focus(&mut self, app: &mut AppState, client_id: i64) -> anyhow::Result<()> { let Some(monado) = &mut app.monado_state else { return Ok(()); // no monado available }; - monado_client_focus(&mut monado.ipc, name) + monado_client_focus(&mut monado.ipc, client_id) } #[cfg(feature = "openxr")] @@ -736,7 +736,7 @@ impl DashInterface for DashInterfaceLive { anyhow::bail!("Not supported in this build.") } #[cfg(not(feature = "openxr"))] - fn monado_client_focus(&mut self, _: &mut AppState, _: &str) -> anyhow::Result<()> { + fn monado_client_focus(&mut self, _: &mut AppState, _: i64) -> anyhow::Result<()> { anyhow::bail!("Not supported in this build.") } #[cfg(not(feature = "openxr"))] @@ -804,16 +804,15 @@ fn monado_list_clients_filtered( } #[cfg(feature = "openxr")] -fn monado_client_focus(monado: &mut libmonado::Monado, name: &str) -> anyhow::Result<()> { +fn monado_client_focus(monado: &mut libmonado::Monado, client_id: i64) -> anyhow::Result<()> { let clients = monado_list_clients_filtered(monado)?; for mut client in clients { - let client_name = client.name()?; - if client_name != name { + if client.id() != client_id as u32 { continue; } - log::info!("Monado focus set to {client_name}"); + log::info!("Monado focus set to {client_id}"); client.set_primary()?; return Ok(()); } diff --git a/wlx-common/src/dash_interface.rs b/wlx-common/src/dash_interface.rs index d61d4311..5af7307f 100644 --- a/wlx-common/src/dash_interface.rs +++ b/wlx-common/src/dash_interface.rs @@ -80,7 +80,7 @@ pub trait DashInterface { 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, filtered: bool) -> anyhow::Result>; - fn monado_client_focus(&mut self, data: &mut T, name: &str) -> anyhow::Result<()>; + fn monado_client_focus(&mut self, data: &mut T, client_id: i64) -> anyhow::Result<()>; fn monado_brightness_get(&mut self, data: &mut T) -> Option; fn monado_brightness_set(&mut self, data: &mut T, brightness: f32) -> Option<()>; fn monado_metrics_set_enabled(&mut self, data: &mut T, enabled: bool) -> bool; diff --git a/wlx-common/src/dash_interface_emulated.rs b/wlx-common/src/dash_interface_emulated.rs index 699282af..2b9d9143 100644 --- a/wlx-common/src/dash_interface_emulated.rs +++ b/wlx-common/src/dash_interface_emulated.rs @@ -251,14 +251,14 @@ impl DashInterface<()> for DashInterfaceEmulated { Ok(self.monado_clients.clone()) } - fn monado_client_focus(&mut self, _data: &mut (), name: &str) -> anyhow::Result<()> { + fn monado_client_focus(&mut self, _data: &mut (), client_id: i64) -> anyhow::Result<()> { for client in self.monado_clients.iter_mut() { client.is_focused = false; client.is_active = false; client.is_primary = false; } - if let Some(client) = self.monado_clients.iter_mut().find(|m| m.name == name) { + if let Some(client) = self.monado_clients.iter_mut().find(|m| m.id == client_id) { client.is_active = true; client.is_focused = true; client.is_primary = true;