Persist focused screen tuning settings

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
Taylor Beeston 2026-04-11 15:11:49 -07:00
parent 40128a6d75
commit 1f341132e0
2 changed files with 67 additions and 6 deletions

View File

@ -131,6 +131,13 @@ pub struct AutoSettings {
pub use_passthrough: bool,
pub screen_render_down: bool,
pub pointer_lerp_factor: f32,
pub focused_screen_assist_x: f32,
pub focused_screen_assist_y: f32,
pub focused_screen_rotate_assist_x: f32,
pub focused_screen_rotate_assist_y: f32,
pub focused_screen_curve_x: f32,
pub focused_screen_distance: f32,
pub focused_screen_scale: f32,
pub space_drag_unlocked: bool,
pub space_rotate_unlocked: bool,
pub clock_12h: bool,
@ -148,7 +155,7 @@ pub struct AutoSettings {
fn get_settings_path() -> PathBuf {
config_io::ConfigRoot::Generic
.get_conf_d_path()
.join("zz-saved-config.json5")
.join("zz-saved-config.yaml")
}
pub fn save_settings(config: &GeneralConfig) -> anyhow::Result<()> {
@ -182,6 +189,13 @@ pub fn save_settings(config: &GeneralConfig) -> anyhow::Result<()> {
use_passthrough: config.use_passthrough,
screen_render_down: config.screen_render_down,
pointer_lerp_factor: config.pointer_lerp_factor,
focused_screen_assist_x: config.focused_screen_assist_x,
focused_screen_assist_y: config.focused_screen_assist_y,
focused_screen_rotate_assist_x: config.focused_screen_rotate_assist_x,
focused_screen_rotate_assist_y: config.focused_screen_rotate_assist_y,
focused_screen_curve_x: config.focused_screen_curve_x,
focused_screen_distance: config.focused_screen_distance,
focused_screen_scale: config.focused_screen_scale,
space_drag_unlocked: config.space_drag_unlocked,
space_rotate_unlocked: config.space_rotate_unlocked,
clock_12h: config.clock_12h,
@ -196,8 +210,8 @@ pub fn save_settings(config: &GeneralConfig) -> anyhow::Result<()> {
language: config.language,
};
let json = serde_json::to_string_pretty(&conf).unwrap(); // want panic
std::fs::write(get_settings_path(), json)?;
let yaml = serde_yaml::to_string(&conf).unwrap(); // want panic
std::fs::write(get_settings_path(), yaml)?;
log::info!("Saved settings.");
Ok(())

View File

@ -7,7 +7,10 @@ use strum::{AsRefStr, EnumProperty, EnumString, VariantArray};
use wayvr_ipc::packet_client::WvrProcessLaunchParams;
use crate::{
astr_containers::{AStrMap, AStrSet}, locale::{self}, overlays::{BackendAttribValue, ToastDisplayMethod, ToastTopic}, windowing::OverlayWindowState
astr_containers::{AStrMap, AStrSet},
locale::{self},
overlays::{BackendAttribValue, ToastDisplayMethod, ToastTopic},
windowing::OverlayWindowState,
};
pub type PwTokenMap = AStrMap<String>;
@ -110,6 +113,30 @@ const fn def_point3() -> f32 {
0.3
}
const fn def_point13() -> f32 {
0.13
}
const fn def_point18() -> f32 {
0.18
}
const fn def_point12() -> f32 {
0.12
}
const fn def_point32() -> f32 {
0.32
}
const fn def_point45() -> f32 {
0.45
}
const fn def_point145() -> f32 {
1.45
}
const fn def_osc_port() -> u16 {
9000
}
@ -138,8 +165,6 @@ const fn def_max_height() -> u16 {
1440
}
#[derive(Deserialize, Serialize)]
pub struct GeneralConfig {
#[serde(default = "def_theme_path")]
@ -277,6 +302,28 @@ pub struct GeneralConfig {
#[serde(default = "def_point3")]
pub pointer_lerp_factor: f32,
#[serde(default = "def_point13")]
pub focused_screen_assist_x: f32,
#[serde(default = "def_point18")]
pub focused_screen_assist_y: f32,
#[serde(default = "def_point13")]
pub focused_screen_rotate_assist_x: f32,
#[serde(default = "def_point12")]
pub focused_screen_rotate_assist_y: f32,
#[serde(default = "def_point32")]
#[serde(alias = "focused_screen_curvature")]
pub focused_screen_curve_x: f32,
#[serde(default = "def_point45")]
pub focused_screen_distance: f32,
#[serde(default = "def_point145")]
pub focused_screen_scale: f32,
#[serde(default = "def_true")]
pub space_drag_unlocked: bool,