add toggle to settings.rs

This commit is contained in:
Diamond White 2026-03-15 13:01:40 +00:00
parent 0ee7671832
commit 55756e6e51
5 changed files with 12 additions and 5 deletions

View File

@ -63,6 +63,8 @@
"KEYBOARD_MIDDLE_CLICK": "Keyboard middle click",
"KEYBOARD_MIDDLE_CLICK_HELP": "Modifier to use when typing\nwith purple laser",
"KEYBOARD_SOUND_ENABLED": "Keyboard sounds",
"KEYBOARD_SWIPE_TO_TYPE_ENABLED": "Keyboard swipe to type",
"KEYBOARD_SWIPE_TO_TYPE_ENABLED_HELP": "Only works for English! Results will be drastically worse on non qwerty keyboards.",
"LANGUAGE": "Language",
"LEFT_HANDED_MOUSE": "Left-handed mouse",
"LEFT_HANDED_MOUSE_HELP": "Use this if mouse buttons are swapped",

View File

@ -228,6 +228,7 @@ enum SettingType {
InvertScrollDirectionY,
KeyboardMiddleClick,
KeyboardSoundEnabled,
KeyboardSwipeToTypeEnabled,
Language,
LeftHandedMouse,
LongPressDuration,
@ -280,6 +281,7 @@ impl SettingType {
Self::HideUsername => &mut config.hide_username,
Self::OpaqueBackground => &mut config.opaque_background,
Self::XwaylandByDefault => &mut config.xwayland_by_default,
Self::KeyboardSwipeToTypeEnabled => &mut config.keyboard_swipe_to_type_enabled,
_ => panic!("Requested bool for non-bool SettingType"),
}
}
@ -378,6 +380,7 @@ impl SettingType {
Self::InvertScrollDirectionY => Ok("APP_SETTINGS.INVERT_SCROLL_DIRECTION_Y"),
Self::KeyboardMiddleClick => Ok("APP_SETTINGS.KEYBOARD_MIDDLE_CLICK"),
Self::KeyboardSoundEnabled => Ok("APP_SETTINGS.KEYBOARD_SOUND_ENABLED"),
Self::KeyboardSwipeToTypeEnabled => Ok("APP_SETTINGS.KEYBOARD_SWIPE_TO_TYPE_ENABLED"),
Self::Language => Ok("APP_SETTINGS.LANGUAGE"),
Self::LeftHandedMouse => Ok("APP_SETTINGS.LEFT_HANDED_MOUSE"),
Self::LongPressDuration => Ok("APP_SETTINGS.LONG_PRESS_DURATION"),
@ -414,6 +417,7 @@ impl SettingType {
Self::GridOpacity => Some("APP_SETTINGS.GRID_OPACITY_HELP"),
Self::HandsfreePointer => Some("APP_SETTINGS.HANDSFREE_POINTER_HELP"),
Self::KeyboardMiddleClick => Some("APP_SETTINGS.KEYBOARD_MIDDLE_CLICK_HELP"),
Self::KeyboardSwipeToTypeEnabled => Some("APP_SETTINGS.KEYBOARD_SWIPE_TO_TYPE_ENABLED_HELP"),
Self::LeftHandedMouse => Some("APP_SETTINGS.LEFT_HANDED_MOUSE_HELP"),
Self::ScreenRenderDown => Some("APP_SETTINGS.SCREEN_RENDER_DOWN_HELP"),
Self::UprightScreenFix => Some("APP_SETTINGS.UPRIGHT_SCREEN_FIX_HELP"),
@ -809,6 +813,7 @@ impl<T> TabSettings<T> {
checkbox!(mp, c, SettingType::NotificationsEnabled);
checkbox!(mp, c, SettingType::NotificationsSoundEnabled);
checkbox!(mp, c, SettingType::KeyboardSoundEnabled);
checkbox!(mp, c, SettingType::KeyboardSwipeToTypeEnabled);
checkbox!(mp, c, SettingType::SpaceDragUnlocked);
checkbox!(mp, c, SettingType::SpaceRotateUnlocked);
slider_f32!(mp, c, SettingType::SpaceDragMultiplier, -10.0, 10.0, 0.5);

View File

@ -243,10 +243,10 @@
</div>
</div>
</rectangle>
<div width="100%" height="13" interactable="0" />
<div width="100%" height="11" interactable="0" />
<rectangle id="swipe_predictions_root" macro="bg_rect" padding="10" align_items="center" justify_content="space_between" flex_direction="row" min_height="60">
</rectangle>
<div width="100%" height="7" interactable="0" />
<div width="100%" height="11" interactable="0" />
<rectangle id="keyboard_root" macro="bg_rect" flex_direction="column" padding="10">
</rectangle>
</div>

View File

@ -477,7 +477,7 @@ pub(super) fn create_keyboard_panel(
elems_changed = true;
}
}
if !app.session.config.swipe_to_type_enabled {
if !app.session.config.keyboard_swipe_to_type_enabled {
panel.state.swipe_typing_manager = None;
panel.state.swipe_candidate_receiver = None;
@ -495,7 +495,7 @@ pub(super) fn create_keyboard_panel(
}
}
if app.session.config.swipe_to_type_enabled && panel.state.swipe_typing_manager.is_none() {
if app.session.config.keyboard_swipe_to_type_enabled && panel.state.swipe_typing_manager.is_none() {
init_swipe_type_manager(&mut panel.state);
let predictions_root = panel.parser_state

View File

@ -329,5 +329,5 @@ pub struct GeneralConfig {
pub grid_opacity: f32,
#[serde(default = "def_true")]
pub swipe_to_type_enabled: bool,
pub keyboard_swipe_to_type_enabled: bool,
}