reset playspace button in settings

This commit is contained in:
galister
2026-01-25 11:44:17 +09:00
parent 3ec1dd7f4e
commit 6960652379
6 changed files with 36 additions and 11 deletions

View File

@@ -83,6 +83,8 @@
"SCREENCOPY_HELP": "Slow, no screen share popups.\nWorks on: Hyprland, Niri, River, Sway"
},
"POINTER_LERP_FACTOR": "Pointer smoothing",
"RESET_PLAYSPACE": "Reset playspace",
"RESET_PLAYSPACE_HELP": "Clear the stage space offset.",
"RESTART_SOFTWARE": "Restart software",
"RESTART_SOFTWARE_HELP": "Apply settings that require a restart",
"ROUND_MULTIPLIER": "UI Edge roundness",

View File

@@ -16,13 +16,13 @@ use wgui::{
};
use wlx_common::{
audio,
dash_interface::BoxDashInterface,
dash_interface::{BoxDashInterface, RecenterMode},
timestep::{self, Timestep},
};
use crate::{
assets,
tab::{Tab, TabType, apps::TabApps, games::TabGames, home::TabHome, monado::TabMonado, settings::TabSettings},
tab::{apps::TabApps, games::TabGames, home::TabHome, monado::TabMonado, settings::TabSettings, Tab, TabType},
util::{
popup_manager::{MountPopupParams, PopupManager, PopupManagerParams},
toast_manager::ToastManager,
@@ -490,7 +490,7 @@ impl<T: 'static> Frontend<T> {
}
fn action_recenter_playspace(&mut self, data: &mut T) -> anyhow::Result<()> {
self.interface.recenter_playspace(data)?;
self.interface.recenter_playspace(data, RecenterMode::Recenter)?;
Ok(())
}

View File

@@ -20,7 +20,7 @@ use wgui::{
widget::label::WidgetLabel,
windowing::context_menu::{self, Blueprint, ContextMenu, TickResult},
};
use wlx_common::{config::GeneralConfig, config_io::ConfigRoot};
use wlx_common::{config::GeneralConfig, config_io::ConfigRoot, dash_interface::RecenterMode};
use crate::{
frontend::{Frontend, FrontendTask},
@@ -60,6 +60,7 @@ enum Task {
ClearPipewireTokens,
ClearSavedState,
DeleteAllConfigs,
ResetPlayspace,
RestartSoftware,
RemoveAutostartApp(Rc<str>),
SetTab(TabNameEnum),
@@ -127,6 +128,10 @@ impl<T> Tab<T> for TabSettings<T> {
std::fs::remove_dir_all(&path)?;
std::fs::create_dir(&path)?;
}
Task::ResetPlayspace => {
frontend.interface.recenter_playspace(data, RecenterMode::Reset)?;
return Ok(());
}
Task::RestartSoftware => {
frontend.interface.restart(data);
return Ok(());
@@ -774,6 +779,13 @@ impl<T> TabSettings<T> {
}
TabNameEnum::Troubleshooting => {
let c = category!(mp, root, "APP_SETTINGS.TROUBLESHOOTING", "dashboard/cpu.svg")?;
danger_button!(
mp,
c,
"APP_SETTINGS.RESET_PLAYSPACE",
"dashboard/recenter.svg",
Task::ResetPlayspace
);
danger_button!(
mp,
c,