From 9547da21cee8b98334fb2dba0497cc2ab2599ea6 Mon Sep 17 00:00:00 2001 From: galister <22305755+galister@users.noreply.github.com> Date: Sat, 10 Jan 2026 03:18:08 +0900 Subject: [PATCH] X button on dashboard --- dash-frontend/assets/gui/dashboard.xml | 7 +++++++ dash-frontend/src/frontend.rs | 12 ++++++++++++ wayvr/src/overlays/dashboard.rs | 5 +++++ wlx-common/src/dash_interface.rs | 1 + wlx-common/src/dash_interface_emulated.rs | 2 ++ 5 files changed, 27 insertions(+) diff --git a/dash-frontend/assets/gui/dashboard.xml b/dash-frontend/assets/gui/dashboard.xml index 9a0c017..cb7dc7e 100644 --- a/dash-frontend/assets/gui/dashboard.xml +++ b/dash-frontend/assets/gui/dashboard.xml @@ -25,6 +25,13 @@ +
+
+
+
+
+
diff --git a/dash-frontend/src/frontend.rs b/dash-frontend/src/frontend.rs index b89065f..23f445d 100644 --- a/dash-frontend/src/frontend.rs +++ b/dash-frontend/src/frontend.rs @@ -100,6 +100,7 @@ pub enum FrontendTask { RecenterPlayspace, PushToast(Translation), PlaySound(SoundType), + HideDashboard, } impl Frontend { @@ -333,6 +334,7 @@ impl Frontend { FrontendTask::RecenterPlayspace => self.action_recenter_playspace(params.data)?, FrontendTask::PushToast(content) => self.toast_manager.push(content), FrontendTask::PlaySound(sound_type) => self.queue_play_sound(sound_type), + FrontendTask::HideDashboard => self.action_hide_dashboard(params.data), }; Ok(()) } @@ -357,6 +359,12 @@ impl Frontend { } fn register_widgets(&mut self) -> anyhow::Result<()> { + // "X" button + self.tasks.handle_button( + &self.state.fetch_component_as::("btn_close")?, + FrontendTask::HideDashboard, + ); + // ################################ // SIDE BUTTONS // ################################ @@ -461,4 +469,8 @@ impl Frontend { self.interface.recenter_playspace(data)?; Ok(()) } + + fn action_hide_dashboard(&mut self, data: &mut T) { + self.interface.toggle_dashboard(data); + } } diff --git a/wayvr/src/overlays/dashboard.rs b/wayvr/src/overlays/dashboard.rs index 0ce7263..da86741 100644 --- a/wayvr/src/overlays/dashboard.rs +++ b/wayvr/src/overlays/dashboard.rs @@ -447,6 +447,11 @@ impl DashInterface for DashInterfaceLive { RESTART.store(true, Ordering::Relaxed); } + fn toggle_dashboard(&mut self, data: &mut AppState) { + data.tasks + .enqueue(TaskType::Overlay(OverlayTask::ToggleDashboard)); + } + #[cfg(feature = "openxr")] fn monado_client_list( &mut self, diff --git a/wlx-common/src/dash_interface.rs b/wlx-common/src/dash_interface.rs index 1fd6fb1..2d2266d 100644 --- a/wlx-common/src/dash_interface.rs +++ b/wlx-common/src/dash_interface.rs @@ -38,6 +38,7 @@ pub trait DashInterface { fn general_config<'a>(&'a mut self, data: &'a mut T) -> &'a mut GeneralConfig; fn config_changed(&mut self, data: &mut T); fn restart(&mut self, data: &mut T); + fn toggle_dashboard(&mut self, data: &mut T); } pub type BoxDashInterface = Box>; diff --git a/wlx-common/src/dash_interface_emulated.rs b/wlx-common/src/dash_interface_emulated.rs index abc74f5..9e76e64 100644 --- a/wlx-common/src/dash_interface_emulated.rs +++ b/wlx-common/src/dash_interface_emulated.rs @@ -227,6 +227,8 @@ impl DashInterface<()> for DashInterfaceEmulated { fn restart(&mut self, _data: &mut ()) {} + fn toggle_dashboard(&mut self, _data: &mut ()) {} + fn monado_client_list(&mut self, _data: &mut ()) -> anyhow::Result> { Ok(self.monado_clients.clone()) }