add setting for default overlay size

This commit is contained in:
galister 2026-07-05 18:28:50 +09:00
parent b2037feacf
commit 137570f548
8 changed files with 14 additions and 5 deletions

View File

@ -108,6 +108,8 @@
"DELETE_ALL_CONFIGS_HELP": "Remove all configuration files from conf.d",
"DOUBLE_CURSOR_FIX": "Double cursor fix",
"DOUBLE_CURSOR_FIX_HELP": "Enable this if you see 2 cursors",
"DEFAULT_OVERLAY_SCALE": "Default overlay size",
"DEFAULT_OVERLAY_SCALE_HELP": "Spawn new overlays at this scale.",
"ENABLED": "Enabled",
"FEATURES": "Features",
"FOCUS_FOLLOWS_MOUSE_MODE": "Mouse move on trigger touch",

View File

@ -315,6 +315,7 @@ enum SettingType {
LongPressDuration,
NotificationsEnabled,
NotificationsSoundEnabled,
DefaultOverlayScale,
OpaqueBackground,
PointerLerpFactor,
ScreenRenderDown,
@ -383,6 +384,7 @@ impl SettingType {
pub fn mut_f32(self, config: &mut GeneralConfig) -> &mut f32 {
match self {
Self::DefaultOverlayScale => &mut config.default_overlay_scale,
Self::GridOpacity => &mut config.grid_opacity,
Self::LongPressDuration => &mut config.long_press_duration,
Self::PointerLerpFactor => &mut config.pointer_lerp_factor,
@ -475,6 +477,7 @@ impl SettingType {
Self::CaptureMethod => Ok("APP_SETTINGS.CAPTURE_METHOD"),
Self::ClickFreezeTimeMs => Ok("APP_SETTINGS.CLICK_FREEZE_TIME_MS"),
Self::Clock12h => Ok("APP_SETTINGS.CLOCK_12H"),
Self::DefaultOverlayScale => Ok("APP_SETTINGS.DEFAULT_OVERLAY_SCALE"),
Self::DoubleCursorFix => Ok("APP_SETTINGS.DOUBLE_CURSOR_FIX"),
Self::FocusFollowsMouseMode => Ok("APP_SETTINGS.FOCUS_FOLLOWS_MOUSE_MODE"),
Self::GridOpacity => Ok("APP_SETTINGS.GRID_OPACITY"),
@ -525,6 +528,7 @@ impl SettingType {
Self::BlockGameInputIgnoreWatch => Some("APP_SETTINGS.BLOCK_GAME_INPUT_IGNORE_WATCH_HELP"),
Self::BlockPosesOnKbdInteraction => Some("APP_SETTINGS.BLOCK_POSES_ON_KBD_INTERACTION_HELP"),
Self::CaptureMethod => Some("APP_SETTINGS.CAPTURE_METHOD_HELP"),
Self::DefaultOverlayScale => Some("APP_SETTINGS.DEFAULT_OVERLAY_SCALE_HELP"),
Self::DoubleCursorFix => Some("APP_SETTINGS.DOUBLE_CURSOR_FIX_HELP"),
Self::GridOpacity => Some("APP_SETTINGS.GRID_OPACITY_HELP"),
Self::HandsfreePointer => Some("APP_SETTINGS.HANDSFREE_POINTER_HELP"),

View File

@ -1,6 +1,6 @@
use crate::tab::settings::{
SettingType, SettingsMountParams, SettingsTab,
macros::{options_category, options_checkbox, options_dropdown, options_slider_f32},
SettingType, SettingsMountParams, SettingsTab,
};
pub struct State {}
@ -19,6 +19,7 @@ impl State {
options_checkbox(par.mp, c, SettingType::OpaqueBackground)?;
options_checkbox(par.mp, c, SettingType::HideUsername)?;
options_checkbox(par.mp, c, SettingType::HideGrabHelp)?;
options_slider_f32(par.mp, c, SettingType::DefaultOverlayScale, 0.7, 1.5, 0.05)?; // min, max, step
options_slider_f32(par.mp, c, SettingType::UiAnimationSpeed, 0.5, 5.0, 0.1)?; // min, max, step
options_slider_f32(par.mp, c, SettingType::UiGradientIntensity, 0.0, 1.0, 0.05)?; // min, max, step
options_slider_f32(par.mp, c, SettingType::UiRoundMultiplier, 0.1, 5.0, 0.1)?;

View File

@ -185,6 +185,7 @@ pub struct AutoSettings {
pub input_emulation_method: InputEmulationMethod,
pub tutorial_graduated: bool,
pub whisper_model: Arc<str>,
pub default_overlay_scale: f32,
}
fn get_settings_path() -> PathBuf {
@ -248,6 +249,7 @@ pub fn save_settings(config: &GeneralConfig) -> anyhow::Result<()> {
input_emulation_method: config.input_emulation_method,
tutorial_graduated: config.tutorial_graduated,
whisper_model: config.whisper_model.clone(),
default_overlay_scale: config.default_overlay_scale,
};
let json = serde_json::to_string_pretty(&conf).unwrap(); // want panic

View File

@ -200,7 +200,7 @@ pub fn new_mirror(name: Arc<str>, session: &AppSession) -> OverlayWindowConfig {
grabbable: true,
curvature: Some(0.15),
transform: Affine3A::from_scale_rotation_translation(
Vec3::ONE * session.config.desktop_view_scale,
Vec3::ONE * session.config.default_overlay_scale,
Quat::IDENTITY,
vec3(0.0, 0.2, -0.35),
),

View File

@ -50,7 +50,7 @@ fn create_screen_from_backend(
interactable: true,
curvature: Some(0.15),
transform: Affine3A::from_scale_rotation_translation(
Vec3::ONE * 1.5 * session.config.desktop_view_scale,
Vec3::ONE * 1.5 * session.config.default_overlay_scale,
Quat::from_rotation_z(angle),
vec3(0.0, 0.0, -0.5),
),

View File

@ -98,7 +98,7 @@ pub fn create_wl_window_overlay(
},
curvature: Some(0.15 * curve_scale),
transform: Affine3A::from_scale_rotation_translation(
Vec3::ONE * scale,
Vec3::ONE * app.session.config.default_overlay_scale * scale,
Quat::IDENTITY,
vec3(0.0, 0.0, z_dist),
),

View File

@ -282,7 +282,7 @@ pub struct GeneralConfig {
pub keyboard_scale: f32,
#[serde(default = "def_one")]
pub desktop_view_scale: f32,
pub default_overlay_scale: f32,
#[serde(default = "def_half")]
pub watch_view_angle_min: f32,