diff options
| author | Yuya Nishihara <yuya@tcha.org> | 2024-05-23 16:01:54 +0900 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-05-29 16:41:03 +0300 |
| commit | c8e46b9d172dfa2ca89d82b87055b8e39622f80c (patch) | |
| tree | 857eda691b4f6c364dac6f966c6e6ada671c7a63 /src | |
| parent | f2ce84b243e4eae837a97a146fe1d8fcf0e512ca (diff) | |
| download | niri-c8e46b9d172dfa2ca89d82b87055b8e39622f80c.tar.gz niri-c8e46b9d172dfa2ca89d82b87055b8e39622f80c.tar.bz2 niri-c8e46b9d172dfa2ca89d82b87055b8e39622f80c.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/input/mod.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/input/mod.rs b/src/input/mod.rs index a36ea62b..893fd7de 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -2219,6 +2219,13 @@ pub fn apply_libinput_settings(config: &niri_config::Input, device: &mut input:: let is_touchpad = device.config_tap_finger_count() > 0; if is_touchpad { let c = &config.touchpad; + let _ = device.config_send_events_set_mode(if c.off { + input::SendEventsMode::DISABLED + } else if c.disabled_on_external_mouse { + input::SendEventsMode::DISABLED_ON_EXTERNAL_MOUSE + } else { + input::SendEventsMode::ENABLED + }); let _ = device.config_tap_set_enabled(c.tap); let _ = device.config_dwt_set_enabled(c.dwt); let _ = device.config_dwtp_set_enabled(c.dwtp); @@ -2272,6 +2279,11 @@ pub fn apply_libinput_settings(config: &niri_config::Input, device: &mut input:: && !is_trackpoint; if is_mouse { let c = &config.mouse; + let _ = device.config_send_events_set_mode(if c.off { + input::SendEventsMode::DISABLED + } else { + input::SendEventsMode::ENABLED + }); let _ = device.config_scroll_set_natural_scroll_enabled(c.natural_scroll); let _ = device.config_accel_set_speed(c.accel_speed); let _ = device.config_left_handed_set(c.left_handed); @@ -2291,6 +2303,11 @@ pub fn apply_libinput_settings(config: &niri_config::Input, device: &mut input:: if is_trackpoint { let c = &config.trackpoint; + let _ = device.config_send_events_set_mode(if c.off { + input::SendEventsMode::DISABLED + } else { + input::SendEventsMode::ENABLED + }); let _ = device.config_scroll_set_natural_scroll_enabled(c.natural_scroll); let _ = device.config_accel_set_speed(c.accel_speed); @@ -2310,6 +2327,11 @@ pub fn apply_libinput_settings(config: &niri_config::Input, device: &mut input:: let is_tablet = device.has_capability(input::DeviceCapability::TabletTool); if is_tablet { let c = &config.tablet; + let _ = device.config_send_events_set_mode(if c.off { + input::SendEventsMode::DISABLED + } else { + input::SendEventsMode::ENABLED + }); let _ = device.config_left_handed_set(c.left_handed); } } |
