aboutsummaryrefslogtreecommitdiff
path: root/src/input.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-01-08 11:53:34 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-01-08 11:53:34 +0400
commit71fef2ad2e873c45279cdd6e629218fb5dea1115 (patch)
tree0aaa9301c311220b5ddfd470994716a0996ee372 /src/input.rs
parentc6841f19e9681e886afcfa136966174ab9cb028a (diff)
downloadniri-71fef2ad2e873c45279cdd6e629218fb5dea1115.tar.gz
niri-71fef2ad2e873c45279cdd6e629218fb5dea1115.tar.bz2
niri-71fef2ad2e873c45279cdd6e629218fb5dea1115.zip
Add a few mouse libinput settings
Diffstat (limited to 'src/input.rs')
-rw-r--r--src/input.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/input.rs b/src/input.rs
index 2692726f..b4211a82 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -119,6 +119,35 @@ impl State {
}
}
}
+
+ // This is how Mutter tells apart mice.
+ let mut is_trackball = false;
+ let mut is_trackpoint = false;
+ if let Some(udev_device) = unsafe { device.udev_device() } {
+ if udev_device.property_value("ID_INPUT_TRACKBALL").is_some() {
+ is_trackball = true;
+ }
+ if udev_device
+ .property_value("ID_INPUT_POINTINGSTICK")
+ .is_some()
+ {
+ is_trackpoint = true;
+ }
+ }
+
+ let is_mouse = device.has_capability(input::DeviceCapability::Pointer)
+ && !is_touchpad
+ && !is_trackball
+ && !is_trackpoint;
+ if is_mouse {
+ let c = &self.niri.config.borrow().input.mouse;
+ let _ = device.config_scroll_set_natural_scroll_enabled(c.natural_scroll);
+ let _ = device.config_accel_set_speed(c.accel_speed);
+
+ if let Some(accel_profile) = c.accel_profile {
+ let _ = device.config_accel_set_profile(accel_profile.into());
+ }
+ }
}
InputEvent::DeviceRemoved { device } => {
self.niri.tablets.remove(device);