Add "off" and "disabled-on-external-mouse" properties to input devices

This is called "events <mode>" in Sway, but we decided to use more abstracted
form for consistency with the other config items. "disabled-on-external-mouse"
is added only to touchpads, but there might be other devices that support this
option.

I think "off" also applies to keyboards, but I'm not going to add the one
because we don't have libinput machinery for the keyboard config, and it's
unlikely that user wants to disable _all_ keyboards. OTOH, pointer devices can
be disabled per type. Perhaps, this should be revisited after implementing #371.
This commit is contained in:
Yuya Nishihara
2024-05-23 16:01:54 +09:00
committed by Ivan Molodetskikh
parent f2ce84b243
commit c8e46b9d17
4 changed files with 52 additions and 0 deletions
+17
View File
@@ -155,6 +155,8 @@ pub enum TrackLayout {
// FIXME: Add the rest of the settings.
#[derive(knuffel::Decode, Debug, Default, PartialEq)]
pub struct Touchpad {
#[knuffel(child)]
pub off: bool,
#[knuffel(child)]
pub tap: bool,
#[knuffel(child)]
@@ -175,10 +177,14 @@ pub struct Touchpad {
pub tap_button_map: Option<TapButtonMap>,
#[knuffel(child)]
pub left_handed: bool,
#[knuffel(child)]
pub disabled_on_external_mouse: bool,
}
#[derive(knuffel::Decode, Debug, Default, PartialEq)]
pub struct Mouse {
#[knuffel(child)]
pub off: bool,
#[knuffel(child)]
pub natural_scroll: bool,
#[knuffel(child, unwrap(argument), default)]
@@ -193,6 +199,8 @@ pub struct Mouse {
#[derive(knuffel::Decode, Debug, Default, PartialEq)]
pub struct Trackpoint {
#[knuffel(child)]
pub off: bool,
#[knuffel(child)]
pub natural_scroll: bool,
#[knuffel(child, unwrap(argument), default)]
@@ -269,6 +277,8 @@ impl From<TapButtonMap> for input::TapButtonMap {
#[derive(knuffel::Decode, Debug, Default, PartialEq)]
pub struct Tablet {
#[knuffel(child)]
pub off: bool,
#[knuffel(child, unwrap(argument))]
pub map_to_output: Option<String>,
#[knuffel(child)]
@@ -2342,6 +2352,7 @@ mod tests {
accel-profile "flat"
scroll-method "two-finger"
tap-button-map "left-middle-right"
disabled-on-external-mouse
}
mouse {
@@ -2352,6 +2363,7 @@ mod tests {
}
trackpoint {
off
natural-scroll
accel-speed 0.0
accel-profile "flat"
@@ -2504,6 +2516,7 @@ mod tests {
track_layout: TrackLayout::Window,
},
touchpad: Touchpad {
off: false,
tap: true,
dwt: true,
dwtp: true,
@@ -2514,8 +2527,10 @@ mod tests {
scroll_method: Some(ScrollMethod::TwoFinger),
tap_button_map: Some(TapButtonMap::LeftMiddleRight),
left_handed: false,
disabled_on_external_mouse: true,
},
mouse: Mouse {
off: false,
natural_scroll: true,
accel_speed: 0.4,
accel_profile: Some(AccelProfile::Flat),
@@ -2523,12 +2538,14 @@ mod tests {
left_handed: false,
},
trackpoint: Trackpoint {
off: true,
natural_scroll: true,
accel_speed: 0.0,
accel_profile: Some(AccelProfile::Flat),
scroll_method: Some(ScrollMethod::OnButtonDown),
},
tablet: Tablet {
off: false,
map_to_output: Some("eDP-1".to_owned()),
left_handed: false,
},