feat(input): additional configuration options

This commit is contained in:
Michael Aaron Murphy 2024-02-19 13:12:00 +01:00 • committed by Michael Murphy
parent 926692200d
commit 02ff3e6445
12 changed files with 423 additions and 287 deletions

View file

@ -6,7 +6,9 @@ use cosmic::{
iced_widget::core::layout, iced_widget::core::layout,
}; };
use cosmic_comp_config::{ use cosmic_comp_config::{
input::{AccelProfile, InputConfig}, input::{
AccelConfig, AccelProfile, InputConfig, ScrollConfig, ScrollMethod, TapButtonMap, TapConfig,
},
XkbConfig, XkbConfig,
}; };
use cosmic_settings_page as page; use cosmic_settings_page as page;
@ -17,19 +19,34 @@ pub mod keyboard;
mod mouse; mod mouse;
mod touchpad; mod touchpad;
crate::cache_dynamic_lazy! {
static ACCELERAION_DESC: String = fl!("acceleration-desc");
static DISABLE_WHILE_TYPING: String = fl!("disable-while-typing");
static DOUBLE_CLICK_SPEED_DESC: String = fl!("double-click-speed", "desc");
static DOUBLE_CLICK_SPEED: String = fl!("double-click-speed");
static PRIMARY_BUTTON: String = fl!("primary-button");
static SCROLLING_NATURAL_DESC: String = fl!("scrolling", "natural-desc");
static SCROLLING_NATURAL: String = fl!("scrolling", "natural");
static SCROLLING_SPEED: String = fl!("scrolling", "speed");
}
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub enum Message { pub enum Message {
SetAcceleration(bool, bool), CloseSpecialCharacterDialog,
SetNaturalScroll(bool, bool),
SetScrollFactor(f64, bool),
SetDoubleClickSpeed(u32, bool),
SetMouseSpeed(f64, bool),
PrimaryButtonSelected(cosmic::widget::segmented_button::Entity, bool),
// seperate close message, to make sure another isn't closed? // seperate close message, to make sure another isn't closed?
DisableWhileTyping(bool, bool),
ExpandInputSourcePopover(Option<String>), ExpandInputSourcePopover(Option<String>),
OpenSpecialCharacterDialog(keyboard::SpecialKey), OpenSpecialCharacterDialog(keyboard::SpecialKey),
CloseSpecialCharacterDialog, PinchToZoom(bool),
PrimaryButtonSelected(cosmic::widget::segmented_button::Entity, bool),
SetAcceleration(bool, bool),
SetDoubleClickSpeed(u32, bool),
SetMouseSpeed(f64, bool),
SetNaturalScroll(bool, bool),
SetScrollFactor(f64, bool),
SetScrollMethod(Option<ScrollMethod>, bool),
SpecialCharacterSelect(Option<&'static str>), SpecialCharacterSelect(Option<&'static str>),
TapToClick(bool),
} }
pub struct Page { pub struct Page {
@ -55,8 +72,8 @@ fn get_config<T: Default + serde::de::DeserializeOwned>(
config: &cosmic_config::Config, config: &cosmic_config::Config,
key: &str, key: &str,
) -> T { ) -> T {
config.get(key).unwrap_or_else(|err| { config.get(key).unwrap_or_else(|why| {
error!(?err, "Failed to read config '{}'", key); error!(?why, "Failed to read config '{}'", key);
T::default() T::default()
}) })
} }
@ -69,19 +86,11 @@ impl Default for Page {
let xkb = get_config(&config, "xkb_config"); let xkb = get_config(&config, "xkb_config");
let mut primary_button = mouse::default_primary_button(); let mut primary_button = mouse::default_primary_button();
let idx = if input_default.left_handed.unwrap_or(false) { let idx = input_default.left_handed.unwrap_or(false) as u16;
1
} else {
0
};
primary_button.activate_position(idx); primary_button.activate_position(idx);
let mut touchpad_primary_button = mouse::default_primary_button(); let mut touchpad_primary_button = mouse::default_primary_button();
let idx = if input_touchpad.left_handed.unwrap_or(false) { let idx = input_touchpad.left_handed.unwrap_or(false) as u16;
1
} else {
0
};
touchpad_primary_button.activate_position(idx); touchpad_primary_button.activate_position(idx);
Self { Self {
@ -117,6 +126,7 @@ impl Page {
} }
} }
#[allow(clippy::too_many_lines)]
pub fn update(&mut self, message: Message) -> iced::Command<app::Message> { pub fn update(&mut self, message: Message) -> iced::Command<app::Message> {
match message { match message {
Message::SetAcceleration(value, touchpad) => { Message::SetAcceleration(value, touchpad) => {
@ -125,26 +135,46 @@ impl Page {
} else { } else {
AccelProfile::Flat AccelProfile::Flat
}; };
self.update_input(touchpad, |x| { self.update_input(touchpad, |x| {
x.acceleration.get_or_insert(Default::default()).profile = Some(profile); x.acceleration.get_or_insert(AccelConfig::default()).profile = Some(profile);
}); });
} }
Message::SetNaturalScroll(value, touchpad) => self.update_input(touchpad, |x| {
x.scroll_config Message::SetMouseSpeed(value, touchpad) => self.update_input(touchpad, |x| {
.get_or_insert(Default::default()) x.acceleration.get_or_insert(AccelConfig::default()).speed = value;
.natural_scroll = Some(value);
}),
Message::SetScrollFactor(value, touchpad) => self.update_input(touchpad, |x| {
x.scroll_config
.get_or_insert(Default::default())
.scroll_factor = Some(value)
}), }),
Message::SetDoubleClickSpeed(_value, _touchpad) => { Message::SetDoubleClickSpeed(_value, _touchpad) => {
// TODO // TODO
} }
Message::SetMouseSpeed(value, touchpad) => self.update_input(touchpad, |x| {
x.acceleration.get_or_insert(Default::default()).speed = value Message::DisableWhileTyping(disabled, touchpad) => {
self.update_input(touchpad, |conf| {
conf.disable_while_typing = Some(disabled);
});
}
Message::SetNaturalScroll(enabled, touchpad) => self.update_input(touchpad, |x| {
x.scroll_config
.get_or_insert(ScrollConfig::default())
.natural_scroll = Some(enabled);
}), }),
Message::SetScrollFactor(value, touchpad) => self.update_input(touchpad, |x| {
x.scroll_config
.get_or_insert(ScrollConfig::default())
.scroll_factor = Some(value);
}),
Message::SetScrollMethod(method, touchpad) => {
self.update_input(touchpad, |conf| {
conf.scroll_config
.get_or_insert(ScrollConfig::default())
.method = method;
});
}
Message::PrimaryButtonSelected(entity, touchpad) => { Message::PrimaryButtonSelected(entity, touchpad) => {
let select_model = if touchpad { let select_model = if touchpad {
&mut self.touchpad_primary_button &mut self.touchpad_primary_button
@ -152,13 +182,19 @@ impl Page {
&mut self.primary_button &mut self.primary_button
}; };
select_model.activate(entity); select_model.activate(entity);
let left_entity = select_model.entity_at(1).unwrap();
let Some(left_entity) = select_model.entity_at(1) else {
return cosmic::Command::none();
};
let left_handed = select_model.active() == left_entity; let left_handed = select_model.active() == left_entity;
self.update_input(touchpad, |x| x.left_handed = Some(left_handed)); self.update_input(touchpad, |x| x.left_handed = Some(left_handed));
} }
Message::ExpandInputSourcePopover(value) => { Message::ExpandInputSourcePopover(value) => {
self.expanded_source_popover = value; self.expanded_source_popover = value;
} }
Message::OpenSpecialCharacterDialog(special_key) => { Message::OpenSpecialCharacterDialog(special_key) => {
self.special_character_dialog = Some(special_key); self.special_character_dialog = Some(special_key);
let window_settings = SctkWindowSettings { let window_settings = SctkWindowSettings {
@ -180,10 +216,12 @@ impl Page {
}; };
return commands::window::get_window(window_settings); return commands::window::get_window(window_settings);
} }
Message::CloseSpecialCharacterDialog => { Message::CloseSpecialCharacterDialog => {
self.special_character_dialog = None; self.special_character_dialog = None;
return commands::window::close_window(*keyboard::SPECIAL_CHARACTER_DIALOGUE_ID); return commands::window::close_window(*keyboard::SPECIAL_CHARACTER_DIALOGUE_ID);
} }
Message::SpecialCharacterSelect(id) => { Message::SpecialCharacterSelect(id) => {
if let Some(special_key) = self.special_character_dialog { if let Some(special_key) = self.special_character_dialog {
let options = self.xkb.options.as_deref().unwrap_or(""); let options = self.xkb.options.as_deref().unwrap_or("");
@ -191,7 +229,7 @@ impl Page {
let new_options = options let new_options = options
.split(',') .split(',')
.filter(|x| !x.starts_with(prefix)) .filter(|x| !x.starts_with(prefix))
.chain(id.into_iter()) .chain(id)
.join(","); .join(",");
self.xkb.options = Some(new_options).filter(|x| !x.is_empty()); self.xkb.options = Some(new_options).filter(|x| !x.is_empty());
if let Err(err) = self.config.set("xkb_config", &self.xkb) { if let Err(err) = self.config.set("xkb_config", &self.xkb) {
@ -199,8 +237,24 @@ impl Page {
} }
} }
} }
Message::PinchToZoom(_enabled) => {}
Message::TapToClick(enabled) => {
self.update_input(true, |conf| {
conf.tap_config
.get_or_insert(TapConfig {
enabled: true,
button_map: Some(TapButtonMap::LeftRightMiddle),
drag: true,
drag_lock: false,
})
.enabled = enabled;
});
}
} }
iced::Command::none()
cosmic::Command::none()
} }
} }

View file

@ -8,10 +8,15 @@ use slotmap::SlotMap;
use super::Message; use super::Message;
crate::cache_dynamic_lazy! {
static MOUSE_ACCELERATION: String = fl!("mouse", "acceleration");
static MOUSE_SPEED: String = fl!("mouse", "speed");
}
pub fn default_primary_button() -> cosmic::widget::segmented_button::SingleSelectModel { pub fn default_primary_button() -> cosmic::widget::segmented_button::SingleSelectModel {
let mut model = cosmic::widget::segmented_button::SingleSelectModel::builder() let mut model = cosmic::widget::segmented_button::SingleSelectModel::builder()
.insert(|b| b.text(fl!("mouse", "primary-button-left"))) .insert(|b| b.text(fl!("primary-button", "left")))
.insert(|b| b.text(fl!("mouse", "primary-button-right"))) .insert(|b| b.text(fl!("primary-button", "right")))
.build(); .build();
model.activate_position(0); model.activate_position(0);
model model
@ -40,26 +45,25 @@ impl page::AutoBind<crate::pages::Message> for Page {}
fn mouse() -> Section<crate::pages::Message> { fn mouse() -> Section<crate::pages::Message> {
Section::default() Section::default()
.descriptions(vec![ .descriptions(vec![
fl!("mouse", "primary-button").into(), super::PRIMARY_BUTTON.as_str().into(),
fl!("mouse", "speed").into(), MOUSE_SPEED.as_str().into(),
fl!("mouse", "acceleration").into(), MOUSE_ACCELERATION.as_str().into(),
fl!("mouse", "acceleration-desc").into(), super::ACCELERAION_DESC.as_str().into(),
fl!("mouse", "double-click-speed").into(), super::DOUBLE_CLICK_SPEED.as_str().into(),
fl!("mouse", "double-click-speed-desc").into(), super::DOUBLE_CLICK_SPEED_DESC.as_str().into(),
]) ])
.view::<Page>(|binder, _page, section| { .view::<Page>(|binder, _page, section| {
let descriptions = &section.descriptions;
let input = binder.page::<super::Page>().expect("input page not found"); let input = binder.page::<super::Page>().expect("input page not found");
settings::view_section(&section.title) settings::view_section(&section.title)
.add(settings::item( .add(settings::item(
&*descriptions[0], &*super::PRIMARY_BUTTON,
cosmic::widget::segmented_selection::horizontal(&input.primary_button) cosmic::widget::segmented_selection::horizontal(&input.primary_button)
.minimum_button_width(0)
.on_activate(|x| Message::PrimaryButtonSelected(x, false)), .on_activate(|x| Message::PrimaryButtonSelected(x, false)),
)) ))
.add( .add(
settings::item::builder(&*descriptions[1]).control(widget::slider( settings::item::builder(&*MOUSE_SPEED).control(widget::slider(
0.0..=100.0, 0.0..=100.0,
(input (input
.input_default .input_default
@ -72,8 +76,8 @@ fn mouse() -> Section<crate::pages::Message> {
)), )),
) )
.add( .add(
settings::item::builder(&*descriptions[2]) settings::item::builder(&*MOUSE_ACCELERATION)
.description(&*descriptions[3]) .description(&*super::ACCELERAION_DESC)
.toggler( .toggler(
input input
.input_default .input_default
@ -84,8 +88,8 @@ fn mouse() -> Section<crate::pages::Message> {
), ),
) )
.add( .add(
settings::item::builder(&*descriptions[4]) settings::item::builder(&*super::DOUBLE_CLICK_SPEED)
.description(&*descriptions[5]) .description(&*super::DOUBLE_CLICK_SPEED_DESC)
.control(widget::slider(0..=100, 0, |x| { .control(widget::slider(0..=100, 0, |x| {
Message::SetDoubleClickSpeed(x, false) Message::SetDoubleClickSpeed(x, false)
})), })),
@ -97,11 +101,11 @@ fn mouse() -> Section<crate::pages::Message> {
fn scrolling() -> Section<crate::pages::Message> { fn scrolling() -> Section<crate::pages::Message> {
Section::default() Section::default()
.title(fl!("mouse-scrolling")) .title(fl!("scrolling"))
.descriptions(vec![ .descriptions(vec![
fl!("mouse-scrolling", "speed").into(), fl!("scrolling", "speed").into(),
fl!("mouse-scrolling", "natural").into(), fl!("scrolling", "natural").into(),
fl!("mouse-scrolling", "natural-desc").into(), fl!("scrolling", "natural-desc").into(),
]) ])
.view::<Page>(|binder, _page, section| { .view::<Page>(|binder, _page, section| {
let descriptions = &section.descriptions; let descriptions = &section.descriptions;

View file

@ -1,24 +1,35 @@
use apply::Apply; use cosmic::iced::Length;
use cosmic::widget::{self, settings}; use cosmic::widget::{self, settings};
use cosmic::Element; use cosmic::{Apply, Element};
use cosmic_comp_config::input::AccelProfile; use cosmic_comp_config::input::{AccelProfile, ScrollMethod};
use cosmic_settings_page::Section; use cosmic_settings_page::Section;
use cosmic_settings_page::{self as page, section}; use cosmic_settings_page::{self as page, section};
use slotmap::SlotMap; use slotmap::SlotMap;
use std::borrow::Cow;
use super::Message; use super::Message;
crate::cache_dynamic_lazy! { crate::cache_dynamic_lazy! {
static MOUSE_SCROLL_SPEED: String = fl!("mouse-scrolling", "speed"); static EDGE_SCROLLING_DESC: String = fl!("edge-scrolling", "desc");
static MOUSE_SCROLL_NATURAL: String = fl!("mouse-scrolling", "natural"); static EDGE_SCROLLING: String = fl!("edge-scrolling");
static MOUSE_SCROLL_NATURAL_DESC: String = fl!("mouse-scrolling", "natural-desc"); static TWO_FINGER_SCROLLING: String = fl!("two-finger-scrolling");
static TOUCHPAD_PRIMARY_BUTTON: String = fl!("touchpad", "primary-button"); static PINCH_TO_ZOOM_DESC: String = fl!("pinch-to-zoom", "desc");
static TOUCHPAD_SPEED: String = fl!("touchpad", "speed"); static PINCH_TO_ZOOM: String = fl!("pinch-to-zoom");
// static SWIPING_FOUR_FINGER_DOWN: String = fl!("swiping", "four-finger-down");
// static SWIPING_FOUR_FINGER_LEFT: String = fl!("swiping", "four-finger-left");
// static SWIPING_FOUR_FINGER_RIGHT: String = fl!("swiping", "four-finger-right");
// static SWIPING_FOUR_FINGER_UP: String = fl!("swiping", "four-finger-up");
// static SWIPING_THREE_FINGER_ANY: String = fl!("swiping", "three-finger-any");
// static SWIPING: String = fl!("swiping");
static TAP_TO_CLICK_DESC: String = fl!("tap-to-click", "desc");
static TAP_TO_CLICK: String = fl!("tap-to-click");
static TAPPING_AND_PINCHING: String = fl!("tapping-and-pinching");
static TOUCHPAD_ACCELERAION: String = fl!("touchpad", "acceleration"); static TOUCHPAD_ACCELERAION: String = fl!("touchpad", "acceleration");
static TOUCHPAD_ACCELERAION_DESC: String = fl!("touchpad", "acceleration-desc"); static TOUCHPAD_SPEED: String = fl!("touchpad", "speed");
static TOUCHPAD_DOUBLE_CLICK_SPEED: String = fl!("touchpad", "double-click-speed"); // static SWITCH_BETWEEN_WINDOWS: String = fl!("switch-between-windows");
static TOUCHPAD_DOUBLE_CLICK_SPEED_DESC: String = fl!("touchpad", "double-click-speed-desc"); // static SWITCH_TO_NEXT_WORKSPACE: String = fl!("switch-to-next-workspace");
// static SWITCH_TO_PREV_WORKSPACE: String = fl!("switch-to-prev-workspace");
// static OPEN_APPLICATION_LIBRARY: String = fl!("open-application-library");
} }
#[derive(Default)] #[derive(Default)]
@ -31,7 +42,9 @@ impl page::Page<crate::pages::Message> for Page {
) -> Option<page::Content> { ) -> Option<page::Content> {
Some(vec![ Some(vec![
sections.insert(touchpad()), sections.insert(touchpad()),
sections.insert(tapping_and_pinching()),
sections.insert(scrolling()), sections.insert(scrolling()),
// sections.insert(swiping()),
]) ])
} }
@ -47,20 +60,22 @@ impl page::AutoBind<crate::pages::Message> for Page {}
fn touchpad() -> Section<crate::pages::Message> { fn touchpad() -> Section<crate::pages::Message> {
Section::default() Section::default()
.descriptions(vec![ .descriptions(vec![
TOUCHPAD_PRIMARY_BUTTON.as_str().into(), super::PRIMARY_BUTTON.as_str().into(),
TOUCHPAD_SPEED.as_str().into(), TOUCHPAD_SPEED.as_str().into(),
TOUCHPAD_ACCELERAION.as_str().into(), TOUCHPAD_ACCELERAION.as_str().into(),
TOUCHPAD_ACCELERAION_DESC.as_str().into(), super::ACCELERAION_DESC.as_str().into(),
TOUCHPAD_DOUBLE_CLICK_SPEED.as_str().into(), super::DISABLE_WHILE_TYPING.as_str().into(),
TOUCHPAD_DOUBLE_CLICK_SPEED_DESC.as_str().into(), super::DOUBLE_CLICK_SPEED.as_str().into(),
super::DOUBLE_CLICK_SPEED_DESC.as_str().into(),
]) ])
.view::<Page>(|binder, _page, section| { .view::<Page>(|binder, _page, section| {
let input = binder.page::<super::Page>().expect("input page not found"); let input = binder.page::<super::Page>().expect("input page not found");
settings::view_section(&section.title) settings::view_section(&section.title)
.add(settings::item( .add(settings::item(
&*TOUCHPAD_PRIMARY_BUTTON, &*super::PRIMARY_BUTTON,
cosmic::widget::segmented_selection::horizontal(&input.touchpad_primary_button) cosmic::widget::segmented_selection::horizontal(&input.touchpad_primary_button)
.minimum_button_width(0)
.on_activate(|x| Message::PrimaryButtonSelected(x, true)), .on_activate(|x| Message::PrimaryButtonSelected(x, true)),
)) ))
.add( .add(
@ -78,7 +93,7 @@ fn touchpad() -> Section<crate::pages::Message> {
) )
.add( .add(
settings::item::builder(&*TOUCHPAD_ACCELERAION) settings::item::builder(&*TOUCHPAD_ACCELERAION)
.description(&*TOUCHPAD_ACCELERAION_DESC) .description(&*super::ACCELERAION_DESC)
.toggler( .toggler(
input input
.input_touchpad .input_touchpad
@ -88,10 +103,15 @@ fn touchpad() -> Section<crate::pages::Message> {
|x| Message::SetAcceleration(x, true), |x| Message::SetAcceleration(x, true),
), ),
) )
// TODO disable while typing
.add( .add(
settings::item::builder(&*TOUCHPAD_DOUBLE_CLICK_SPEED) settings::item::builder(&*super::DISABLE_WHILE_TYPING).toggler(
.description(&*TOUCHPAD_DOUBLE_CLICK_SPEED_DESC) input.input_touchpad.disable_while_typing.unwrap_or(false),
|enabled| Message::DisableWhileTyping(enabled, true),
),
)
.add(
settings::item::builder(&*super::DOUBLE_CLICK_SPEED)
.description(&*super::DOUBLE_CLICK_SPEED_DESC)
.control(widget::slider(0..=100, 0, |x| { .control(widget::slider(0..=100, 0, |x| {
Message::SetDoubleClickSpeed(x, true) Message::SetDoubleClickSpeed(x, true)
})), })),
@ -101,26 +121,61 @@ fn touchpad() -> Section<crate::pages::Message> {
}) })
} }
fn tapping_and_pinching() -> Section<crate::pages::Message> {
Section::default()
.title(fl!("tapping-and-pinching"))
.descriptions(vec![
TAP_TO_CLICK.as_str().into(),
TAP_TO_CLICK_DESC.as_str().into(),
PINCH_TO_ZOOM.as_str().into(),
PINCH_TO_ZOOM_DESC.as_str().into(),
])
.view::<Page>(|binder, _page, _section| {
let page = binder
.page::<super::Page>()
.expect("input devices page not found");
settings::view_section(&*TAPPING_AND_PINCHING)
.add(
settings::item::builder(&*TAP_TO_CLICK).toggler(
page.input_touchpad
.tap_config
.as_ref()
.map_or(false, |x| x.enabled),
Message::TapToClick,
),
)
.add(settings::item::builder(&*PINCH_TO_ZOOM).toggler(false, Message::PinchToZoom))
.apply(Element::from)
.map(crate::pages::Message::Input)
})
}
fn scrolling() -> Section<crate::pages::Message> { fn scrolling() -> Section<crate::pages::Message> {
Section::default() Section::default()
.title(fl!("mouse-scrolling")) .title(fl!("scrolling"))
.descriptions(vec![ .descriptions(vec![
MOUSE_SCROLL_SPEED.as_str().into(), super::SCROLLING_SPEED.as_str().into(),
MOUSE_SCROLL_NATURAL.as_str().into(), super::SCROLLING_NATURAL.as_str().into(),
MOUSE_SCROLL_NATURAL_DESC.as_str().into(), super::SCROLLING_NATURAL_DESC.as_str().into(),
TWO_FINGER_SCROLLING.as_str().into(),
EDGE_SCROLLING.as_str().into(),
EDGE_SCROLLING_DESC.as_str().into(),
]) ])
.view::<Page>(|binder, _page, section| { .view::<Page>(|binder, _page, section| {
let input = binder.page::<super::Page>().expect("input page not found"); let page = binder
.page::<super::Page>()
.expect("input devices page not found");
settings::view_section(&section.title) settings::view_section(&section.title)
// Scroll speed slider
.add(settings::item( .add(settings::item(
&*MOUSE_SCROLL_SPEED, &*super::SCROLLING_SPEED,
// TODO show numeric value // TODO show numeric value
// TODO desired range? // TODO desired range?
widget::slider( widget::slider(
1.0..=100.0, 1.0..=1000.0,
input page.input_touchpad
.input_touchpad
.scroll_config .scroll_config
.as_ref() .as_ref()
.and_then(|x| x.scroll_factor) .and_then(|x| x.scroll_factor)
@ -131,20 +186,63 @@ fn scrolling() -> Section<crate::pages::Message> {
|value| Message::SetScrollFactor(2f64.powf((value - 50.0) / 10.0), true), |value| Message::SetScrollFactor(2f64.powf((value - 50.0) / 10.0), true),
), ),
)) ))
// Natural scrolling toggle
.add( .add(
settings::item::builder(&*MOUSE_SCROLL_NATURAL) settings::item::builder(&*super::SCROLLING_NATURAL)
.description(&*MOUSE_SCROLL_NATURAL_DESC) .description(&*super::SCROLLING_NATURAL_DESC)
.toggler( .toggler(
input page.input_touchpad
.input_touchpad
.scroll_config .scroll_config
.as_ref() .as_ref()
.and_then(|x| x.natural_scroll) .map_or(false, |conf| conf.natural_scroll.unwrap_or(false)),
.unwrap_or(false), |enabled| Message::SetNaturalScroll(enabled, true),
|x| Message::SetNaturalScroll(x, true), ),
)
// Two-finger scrolling toggle
.add(
settings::item::builder(&*TWO_FINGER_SCROLLING).toggler(
page.input_touchpad
.scroll_config
.as_ref()
.map_or(false, |x| matches!(x.method, Some(ScrollMethod::TwoFinger))),
|enabled| {
Message::SetScrollMethod(
enabled.then_some(ScrollMethod::TwoFinger),
true,
)
},
),
)
// Edge scrolling toggle
.add(
settings::item::builder(&*EDGE_SCROLLING)
.description(&*EDGE_SCROLLING_DESC)
.toggler(
page.input_touchpad
.scroll_config
.as_ref()
.map_or(false, |x| matches!(x.method, Some(ScrollMethod::Edge))),
|enabled| {
Message::SetScrollMethod(
enabled.then_some(ScrollMethod::Edge),
true,
)
},
), ),
) )
.apply(Element::from) .apply(Element::from)
.map(crate::pages::Message::Input) .map(crate::pages::Message::Input)
}) })
} }
// fn swiping() -> Section<crate::pages::Message> {
// Section::default()
// .title(&*SWIPING)
// .descriptions(vec![
// SWIPING_FOUR_FINGER_DOWN.as_str().into(),
// SWIPING_FOUR_FINGER_LEFT.as_str().into(),
// SWIPING_FOUR_FINGER_RIGHT.as_str().into(),
// SWIPING_FOUR_FINGER_UP.as_str().into(),
// SWIPING_THREE_FINGER_ANY.as_str().into(),
// ])
// }

View file

@ -224,8 +224,19 @@ users = Uživatelé
## Input ## Input
input = Vstup acceleration-desc = Automaticky upravit citlivost sledování na základě rychlosti.
.desc = Vstup
double-click-speed = Rychlost dvojtého kliknutí
.desc = Změní jak rychle je třeba zmáčknout dvakrát pro zaznamenání dvojkliku.
primary-button = Hlavní tlačítko
.left = Levé
.right = Pravé
scrolling = Skrolování
.speed = Rychlost skrolování
.natural = Přirozené skrolování
.natural-desc = Převrátí směr skrolování
## Input: Keyboard ## Input: Keyboard
@ -250,31 +261,15 @@ keyboard-shortcuts = Klávesové zkratky
.desc = Zobrazit a změnit klávesové zkratky .desc = Zobrazit a změnit klávesové zkratky
## Input: Mouse ## Input: Mouse
mouse = Myš mouse = Myš
.desc = Citlivost myši, akcelerace, přirozené skrolování. .desc = Citlivost myši, akcelerace, přirozené skrolování.
.primary-button = Hlavní tlačítko
.primary-button-left = Levé
.primary-button-right = Pravé
.speed = Citlivost myši .speed = Citlivost myši
.acceleration = Zapnout akceleraci myši .acceleration = Zapnout akceleraci myši
.acceleration-desc = Automaticky upravit citlivost sledování na základě rychlosti.
.double-click-speed = Rychlost dvojtého kliknutí
.double-click-speed-desc = Změní jak rychle je třeba zmáčknout dvakrát pro zaznamenání dvojkliku.
mouse-scrolling = Skrolování
.speed = Rychlost skrolování
.natural = Přirozené skrolování
.natural-desc = Převrátí směr skrolování
## Input: Touchpad ## Input: Touchpad
touchpad = Touchpad touchpad = Touchpad
.desc = Citlivost touchpadu, nastavení klikání, gesta. .desc = Citlivost touchpadu, nastavení klikání, gesta.
.primary-button = Hlavní tlačítko
.primary-button-left = Levé
.primary-button-right = Pravé
.speed = Citlivost touchpadu .speed = Citlivost touchpadu
.acceleration = Zapnout akceleraci touchpadu .acceleration = Zapnout akceleraci touchpadu
.acceleration-desc = Automaticky upravit citlivost sledování na základě rychlosti.
.double-click-speed = Rychlost dvojtého kliknutí
.double-click-speed-desc = Změní jak rychle je třeba zmáčknout dvakrát pro zaznamenání dvojkliku.

View file

@ -356,9 +356,25 @@ users = Users
## Input ## Input
acceleration-desc = Automatically adjusts tracking sensitivity based on speed.
disable-while-typing = Disable while typing
double-click-speed = Double-click speed
.desc = Changes how fast double-clicks have to be to register.
input-devices = Input Devices input-devices = Input Devices
.desc = Input Devices .desc = Input Devices
primary-button = Primary button
.left = Left
.right = Right
scrolling = Scrolling
.speed = Scrolling speed
.natural = Natural scrolling
.natural-desc = Scroll the content, instead of the view
## Input: Keyboard ## Input: Keyboard
keyboard = Keyboard keyboard = Keyboard
@ -382,31 +398,35 @@ keyboard-shortcuts = Keyboard Shortcuts
.desc = View and customize shortcuts .desc = View and customize shortcuts
## Input: Mouse ## Input: Mouse
mouse = Mouse mouse = Mouse
.desc = Mouse speed, acceleration, natural scrolling. .desc = Mouse speed, acceleration, natural scrolling.
.primary-button = Primary button
.primary-button-left = Left
.primary-button-right = Right
.speed = Mouse speed .speed = Mouse speed
.acceleration = Enable mouse acceleration .acceleration = Enable mouse acceleration
.acceleration-desc = Automatically adjusts tracking sensitivty based on speed.
.double-click-speed = Double-click speed
.double-click-speed-desc = Changes how fast double-clicks have to be to register.
mouse-scrolling = Scrolling
.speed = Scrolling speed
.natural = Natural scrolling
.natural-desc = Scroll the content, instead of the view
## Input: Touchpad ## Input: Touchpad
edge-scrolling = Edge scrolling
.desc = Scroll using the edge of the touchpad.
pinch-to-zoom = Pinch to zoom
.desc = Use two fingers to zoom into content, for applications that support zoom.
swiping = Swiping
.four-finger-down = Four-finger swipe down
.four-finger-left = Four-finger swipe left
.four-finger-right = Four-finger swipe right
.four-finger-up = Four-finger swipe up
.three-finger-any = Three-finger swip any direction
tap-to-click = Tap to click
.desc = Enables single-finger tap for primary click, two-finger tap for secondary click, and three-finger tap for middle click.
tapping-and-pinching = Tapping and Pinching
touchpad = Touchpad touchpad = Touchpad
.desc = Touchpad speed, click options, gestures.
.primary-button = Primary button
.primary-button-left = Left
.primary-button-right = Right
.speed = Touchpad speed
.acceleration = Enable touchpad acceleration .acceleration = Enable touchpad acceleration
.acceleration-desc = Automatically adjusts tracking sensitivty based on speed. .desc = Touchpad speed, click options, gestures.
.double-click-speed = Double-click speed .speed = Touchpad speed
.double-click-speed-desc = Changes how fast double-clicks have to be to register.
two-finger-scrolling = Two-finger scrolling

View file

@ -295,8 +295,19 @@ users = Utenti
## Input ## Input
input = Input acceleration-desc = Aggiusta automaticamente la sensibilità di tracciamento in base alla velocità.
.desc = Input
double-click-speed = Velocità doppio-click
.desc = Cambia quanto deve essere veloce il doppio-click per essere riconosciuto tale.
primary-button = Tasto principale
.left = Sinistro
.right = Destro
scrolling = Scorrimento
.speed = Velocità di scorrimento
.natural = Scorrimento naturale
.natural-desc = Scorri il contenuto invece che la visualizzazione
## Input: Keyboard ## Input: Keyboard
@ -321,31 +332,15 @@ keyboard-shortcuts = Scorciatoie da Tastiera
.desc = Vedi e personalizza le scorciatoie .desc = Vedi e personalizza le scorciatoie
## Input: Mouse ## Input: Mouse
mouse = Mouse mouse = Mouse
.desc = Velocità, accelerazione, scorrimento naturale del mouse. .desc = Velocità, accelerazione, scorrimento naturale del mouse.
.primary-button = Tasto principale
.primary-button-left = Sinistro
.primary-button-right = Destro
.speed = Velocità mouse .speed = Velocità mouse
.acceleration = Abilita accelerazione mouse .acceleration = Abilita accelerazione mouse
.acceleration-desc = Aggiusta automaticamente la sensibilità di tracciamento in base alla velocità.
.double-click-speed = Velocità doppio-click
.double-click-speed-desc = Cambia quanto deve essere veloce il doppio-click per essere riconosciuto tale.
mouse-scrolling = Scorrimento
.speed = Velocità di scorrimento
.natural = Scorrimento naturale
.natural-desc = Scorri il contenuto invece che la visualizzazione
## Input: Touchpad ## Input: Touchpad
touchpad = Touchpad touchpad = Touchpad
.desc = Velocità, opzioni click e movimenti sul touchpad. .desc = Velocità, opzioni click e movimenti sul touchpad.
.primary-button = Tasto principale
.primary-button-left = Sinistro
.primary-button-right = Destro
.speed = Velocità touchpad .speed = Velocità touchpad
.acceleration = Abilita accelerazione touchpad .acceleration = Abilita accelerazione touchpad
.acceleration-desc = Aggiusta automaticamente la sensibilità di tracciamento in base alla velocità.
.double-click-speed = Velocità doppio-click
.double-click-speed-desc = Cambia quanto deve essere veloce il doppio-click per essere riconosciuto tale.

View file

@ -367,8 +367,22 @@ users = Użytkownicy
## Input ## Input
input = Wprowadzanie Danych acceleration-desc = Automatycznie dostosuj dokładność śledzenia opierając się na szybkości ruchu myszki.
.desc = Wprowadzanie Danych
double-click-speed = Prędkość podwójnego kliknięcia
.desc = Ustawia to, jak szybkie musi być podwójnego kliknięcia, by było zarejestrowane.
input-devices = Urządzenia Wejściowe
.desc = Urządzenia Wejściowe
primary-button = Główny przycisk
.left = Lewy
.right = Prawy
scrolling = Przewijanie
.speed = Prędkość przewijania
.natural = Naturalne przewijanie
.natural-desc = Przewijaj zawartość, nie widok
## Input: Keyboard ## Input: Keyboard
@ -395,29 +409,12 @@ keyboard-shortcuts = Skróty Klawiaturowe
## Input: Mouse ## Input: Mouse
mouse = Myszka mouse = Myszka
.desc = Prędkość, przyśpieszenie i naturalne przewijanie myszki .desc = Prędkość, przyśpieszenie i naturalne przewijanie myszki
.primary-button = Główny przycisk
.primary-button-left = Lewy
.primary-button-right = Prawy
.speed = Prędkość myszki .speed = Prędkość myszki
.acceleration = Włącz przyśpieszenie myszki .acceleration = Włącz przyśpieszenie myszki
.acceleration-desc = Automatycznie dostosuj dokładność śledzenia opierając się na szybkości ruchu myszki.
.double-click-speed = Prędkość podwójnego kliknięcia
.double-click-speed-desc = Ustawia to, jak szybkie musi być podwójnego kliknięcia, by było zarejestrowane.
mouse-scrolling = Przewijanie
.speed = Prędkość przewijania
.natural = Naturalne przewijanie
.natural-desc = Przewijaj zawartość, nie widok
## Input: Touchpad ## Input: Touchpad
touchpad = Gładzik touchpad = Gładzik
.desc = Prędkość, opcje klikania i gesty gładzikiem. .desc = Prędkość, opcje klikania i gesty gładzikiem.
.primary-button = Główny przycisk
.primary-button-left = Lewy
.primary-button-right = Prawy
.speed = Prędkość Gładzika .speed = Prędkość Gładzika
.acceleration = Włącz przyśpieszenie gładzika .acceleration = Włącz przyśpieszenie gładzika
.acceleration-desc = Automatycznie dostosuj dokładność śledzenia opierając się na szybkości ruchu gładzika.
.double-click-speed = Prędkość podwójnego kliknięcia
.double-click-speed-desc = Ustawia to, jak szybkie musi być podwójnego kliknięcia, by było zarejestrowane.

View file

@ -295,8 +295,19 @@ users = Пользователи
## Input ## Input
input = Ввод acceleration-desc = Автоматически регулирует чувствительность панели в зависимости от скорости.
.desc = Ввод
double-click-speed = Скорость двойного нажатия
.desc = Изменить скорость регистрации двойных нажатий.
primary-button = Основная кнопка
.left = Левая
.right = Правая
scrolling = Прокрутка
.speed = Скорость прокрутки
.natural = Естественная прокрутка
.natural-desc = Прокручивать содержимое, а не представление
## Input: Keyboard ## Input: Keyboard
@ -323,29 +334,12 @@ keyboard-shortcuts = Сочетания клавиш
## Input: Mouse ## Input: Mouse
mouse = Мышь mouse = Мышь
.desc = Скорость и ускорение мыши, естественная прокрутка. .desc = Скорость и ускорение мыши, естественная прокрутка.
.primary-button = Основная кнопка
.primary-button-left = Левая
.primary-button-right = Правая
.speed = Скорость мыши .speed = Скорость мыши
.acceleration = Включить ускорение мыши .acceleration = Включить ускорение мыши
.acceleration-desc = Автоматически регулирует чувствительность мыши в зависимости от скорости.
.double-click-speed = Скорость двойного нажатия
.double-click-speed-desc = Изменить скорость регистрации двойных нажатий.
mouse-scrolling = Прокрутка
.speed = Скорость прокрутки
.natural = Естественная прокрутка
.natural-desc = Прокручивать содержимое, а не представление
## Input: Touchpad ## Input: Touchpad
touchpad = Сенсорная панель touchpad = Сенсорная панель
.desc = Скорость сенсорной панели, параметры нажатия, жесты. .desc = Скорость сенсорной панели, параметры нажатия, жесты.
.primary-button = Основная кнопка
.primary-button-left = Левая
.primary-button-right = Правая
.speed = Скорость сенсорной панели .speed = Скорость сенсорной панели
.acceleration = Включить ускорение сенсорной панели .acceleration = Включить ускорение сенсорной панели
.acceleration-desc = Автоматически регулирует чувствительность панели в зависимости от скорости.
.double-click-speed = Скорость двойного нажатия
.double-click-speed-desc = Изменить скорость регистрации двойных нажатий.

View file

@ -357,8 +357,19 @@ users = Корисници
## Input ## Input
input = Унос acceleration-desc = Аутоматски подешава осетљивост праћења на основу брзине.
.desc = Унос
double-click-speed = Брзина двоструког клика
.desc = Мења потребну брзину за регистровање двоструких кликова.
primary-button = Примарно дугме
.left = Лево
.right = Десно
scrolling = Померање
.speed = Брзина померања
.natural = Природно померање
.natural-desc = Окретање точка помера садржај уместо приказа.
## Input: Keyboard ## Input: Keyboard
@ -385,29 +396,12 @@ keyboard-shortcuts = Пречице на тастатури
## Input: Mouse ## Input: Mouse
mouse = Миш mouse = Миш
.desc = Брзина миша, убрзање, природно померање. .desc = Брзина миша, убрзање, природно померање.
.primary-button = Примарно дугме
.primary-button-left = Лево
.primary-button-right = Десно
.speed = Брзина миша .speed = Брзина миша
.acceleration = Омогући убрзање миша .acceleration = Омогући убрзање миша
.acceleration-desc = Аутоматски подешава осетљивост праћења на основу брзине.
.double-click-speed = Брзина двоструког клика
.double-click-speed-desc = Мења потребну брзину за регистровање двоструких кликова.
mouse-scrolling = Померање
.speed = Брзина померања
.natural = Природно померање
.natural-desc = Окретање точка помера садржај уместо приказа.
## Input: Touchpad ## Input: Touchpad
touchpad = Додирна табла touchpad = Додирна табла
.desc = Брзина додирне табле, опције клика, покрети. .desc = Брзина додирне табле, опције клика, покрети.
.primary-button = Примарно дугме
.primary-button-left = Лево
.primary-button-right = Десно
.speed = Брзина додирне табле .speed = Брзина додирне табле
.acceleration = Омогући убрзање додирне табле .acceleration = Омогући убрзање додирне табле
.acceleration-desc = Аутоматски подешава осетљивост праћења на основу брзине.
.double-click-speed = Брзина двоструког клика
.double-click-speed-desc = Мења потребну брзину за регистровање двоструких кликова.

View file

@ -357,8 +357,19 @@ users = Korisnici
## Input ## Input
input = Unos acceleration-desc = Automatski podešava osetljivost praćenja na osnovu brzine.
.desc = Unos
double-click-speed = Brzina dvostrukog klika
.desc = Menja potrebnu brzinu za registrovanje dvostrukih klikova.
primary-button = Primarno dugme
.left = Levo
.right = Desno
scrolling = Pomeranje
.speed = Brzina pomeranja
.natural = Prirodno pomeranje
.natural-desc = Okretanje točka pomera sadržaj umesto prikaza.
## Input: Keyboard ## Input: Keyboard
@ -383,31 +394,15 @@ keyboard-shortcuts = Prečice na tastaturi
.desc = Pregledajte i prilagodite prečice .desc = Pregledajte i prilagodite prečice
## Input: Mouse ## Input: Mouse
mouse = Miš mouse = Miš
.desc = Brzina miša, ubrzanje, prirodno pomeranje. .desc = Brzina miša, ubrzanje, prirodno pomeranje.
.primary-button = Primarno dugme
.primary-button-left = Levo
.primary-button-right = Desno
.speed = Brzina miša .speed = Brzina miša
.acceleration = Omogući ubrzanje miša .acceleration = Omogući ubrzanje miša
.acceleration-desc = Automatski podešava osetljivost praćenja na osnovu brzine.
.double-click-speed = Brzina dvostrukog klika
.double-click-speed-desc = Menja potrebnu brzinu za registrovanje dvostrukih klikova.
mouse-scrolling = Pomeranje
.speed = Brzina pomeranja
.natural = Prirodno pomeranje
.natural-desc = Okretanje točka pomera sadržaj umesto prikaza.
## Input: Touchpad ## Input: Touchpad
touchpad = Dodirna tabla touchpad = Dodirna tabla
.desc = Brzina dodirne table, opcije klika, pokreti. .desc = Brzina dodirne table, opcije klika, pokreti.
.primary-button = Primarno dugme
.primary-button-left = Levo
.primary-button-right = Desno
.speed = Brzina dodirne table .speed = Brzina dodirne table
.acceleration = Omogući ubrzanje dodirne table .acceleration = Omogući ubrzanje dodirne table
.acceleration-desc = Automatski podešava osetljivost praćenja na osnovu brzine.
.double-click-speed = Brzina dvostrukog klika
.double-click-speed-desc = Menja potrebnu brzinu za registrovanje dvostrukih klikova.

View file

@ -351,12 +351,23 @@ firmware = Fast programvara
users = Användare users = Användare
.desc = Autentisering och login, låsskärm. .desc = Autentisering och login, låsskärm.
## Inmatning ## Input
input = Inmatning acceleration-desc = Justerar automatiskt spårningskänsligheten baserat på hastighet.
.desc = Inmatning
## Input: Tangentbord double-click-speed = Dubbelklickshastighet
.desc = Ändrar hur snabba dubbelklick måste vara för att registreras.
primary-button = Primär knapp
.left = Vänster
.right = Höger
scrolling = Rullning
.speed = Rullningshastighet
.natural = Naturlig rullning
.natural-desc = Rulla igenom innehållet istället för vyn
## Input: Keyboard
keyboard = Tangentbord keyboard = Tangentbord
.desc = Tangentbordsinmatning .desc = Tangentbordsinmatning
@ -373,37 +384,21 @@ keyboard-special-char = Specialteckenssinmatning
.alternate = Alternativa tecken-knapp .alternate = Alternativa tecken-knapp
.compose = Compose knapp .compose = Compose knapp
## Inmatning: Tangentbord: Genvägar ## Input: Keyboard shortcuts
keyboard-shortcuts = Tangentbordsgenvägar keyboard-shortcuts = Tangentbordsgenvägar
.desc = Visa och anpassa genvägar .desc = Visa och anpassa genvägar
## Inmatning: Mus ## Input: Mouse
mouse = Mus mouse = Mus
.desc = Mushastighet, acceleration, naturlig rullning. .desc = Mushastighet, acceleration, naturlig rullning.
.primary-button = Primär knapp
.primary-button-left = Vänster
.primary-button-right = Höger
.speed = Mushastighet .speed = Mushastighet
.acceleration = Aktivera mus acceleration .acceleration = Aktivera mus acceleration
.acceleration-desc = Justerar automatiskt spårningskänsligheten baserat på hastighet.
.double-click-speed = Dubbelklickshastighet
.double-click-speed-desc = Ändrar hur snabba dubbelklick måste vara för att registreras.
mouse-scrolling = Rullning ## Input: Touchpad
.speed = Rullningshastighet
.natural = Naturlig rullning
.natural-desc = Rulla igenom innehållet istället för vyn
## Inmatning: Pekplatta
touchpad = Pekplatta touchpad = Pekplatta
.desc = Pekplattans hastighet, klickalternativ, gester. .desc = Pekplattans hastighet, klickalternativ, gester.
.primary-button = Primär knapp
.primary-button-left = Vänster
.primary-button-right = Höger
.speed = Pekplattans hastighet .speed = Pekplattans hastighet
.acceleration = Aktivera pekplattans acceleration .acceleration = Aktivera pekplattans acceleration
.acceleration-desc = Justerar automatiskt spårningskänsligheten baserat på hastighet.
.double-click-speed = Dubbelklickshastighet
.double-click-speed-desc = Ändrar hur snabba dubbelklick måste vara för att registreras.

View file

@ -263,8 +263,19 @@ users = 使用者
## Input ## Input
input = 輸入 acceleration-desc = 自動依照觸控板移動加速度即時變更滑鼠速度
.desc = 輸入
double-click-speed = 按兩下觸控板的速度
.desc = 設定按兩下觸控板要以多短的間隔才會觸發按兩下事件
primary-button = 主要按鈕
.left = 左
.right = 右
scrolling = 捲動
.speed = 捲動速度
.natural = 自然捲動
.natural-desc = 捲動內容而非視界
## Input: Keyboard ## Input: Keyboard
@ -289,31 +300,15 @@ keyboard-shortcuts = 鍵盤快捷鍵
.desc = 顯示與修改快捷鍵 .desc = 顯示與修改快捷鍵
## Input: Mouse ## Input: Mouse
mouse = 滑鼠 mouse = 滑鼠
.desc = 滑鼠靈敏度、加速及捲動設定 .desc = 滑鼠靈敏度、加速及捲動設定
.primary-button = 主要按鈕
.primary-button-left = 左
.primary-button-right = 右
.speed = 滑鼠速度 .speed = 滑鼠速度
.acceleration = 啟用滑鼠加速 .acceleration = 啟用滑鼠加速
.acceleration-desc = 自動依照滑鼠移動加速度即時變更滑鼠速度
.double-click-speed = 按兩下按鈕的速度
.double-click-speed-desc = 設定雙按兩下按鈕要以多短的間隔才會觸發按兩下事件
mouse-scrolling = 捲動
.speed = 捲動速度
.natural = 自然捲動
.natural-desc = 捲動內容而非視界
## Input: Touchpad ## Input: Touchpad
touchpad = 觸控板 touchpad = 觸控板
.desc = 觸控靈敏度、點擊和手勢 .desc = 觸控靈敏度、點擊和手勢
.primary-button = 主要按鈕
.primary-button-left = 左
.primary-button-right = 右
.speed = 觸控靈敏度 .speed = 觸控靈敏度
.acceleration = 啟用觸控板加速 .acceleration = 啟用觸控板加速
.acceleration-desc = 自動依照觸控板移動加速度即時變更滑鼠速度
.double-click-speed = 按兩下觸控板的速度
.double-click-speed-desc = 設定按兩下觸控板要以多短的間隔才會觸發按兩下事件