forge
Explore
Log in

Don't you dare go Hollow

Add middle-emulation libinput flag

Browse files at this commit

2e906fc5fa9db0aa69cded149732d62b4b219aeeIvan MolodetskikhParent: a5a3493
niri-config/src/lib.rsmodified+10 -0
@@ -177,6 +177,8 @@ pub struct Touchpad {
177 pub left_handed: bool,177 pub left_handed: bool,
178 #[knuffel(child)]178 #[knuffel(child)]
179 pub disabled_on_external_mouse: bool,179 pub disabled_on_external_mouse: bool,
180+ #[knuffel(child)]
181+ pub middle_emulation: bool,
180 }182 }
181 183
182 #[derive(knuffel::Decode, Debug, Default, PartialEq)]184 #[derive(knuffel::Decode, Debug, Default, PartialEq)]
@@ -193,6 +195,8 @@ pub struct Mouse {
193 pub scroll_method: Option<ScrollMethod>,195 pub scroll_method: Option<ScrollMethod>,
194 #[knuffel(child)]196 #[knuffel(child)]
195 pub left_handed: bool,197 pub left_handed: bool,
198+ #[knuffel(child)]
199+ pub middle_emulation: bool,
196 }200 }
197 201
198 #[derive(knuffel::Decode, Debug, Default, PartialEq)]202 #[derive(knuffel::Decode, Debug, Default, PartialEq)]
@@ -207,6 +211,8 @@ pub struct Trackpoint {
207 pub accel_profile: Option<AccelProfile>,211 pub accel_profile: Option<AccelProfile>,
208 #[knuffel(child, unwrap(argument, str))]212 #[knuffel(child, unwrap(argument, str))]
209 pub scroll_method: Option<ScrollMethod>,213 pub scroll_method: Option<ScrollMethod>,
214+ #[knuffel(child)]
215+ pub middle_emulation: bool,
210 }216 }
211 217
212 #[derive(Debug, Clone, Copy, PartialEq, Eq)]218 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -2545,6 +2551,7 @@ mod tests {
2545 accel-speed 0.42551 accel-speed 0.4
2546 accel-profile "flat"2552 accel-profile "flat"
2547 scroll-method "no-scroll"2553 scroll-method "no-scroll"
2554+ middle-emulation
2548 }2555 }
2549 2556
2550 trackpoint {2557 trackpoint {
@@ -2713,6 +2720,7 @@ mod tests {
2713 tap_button_map: Some(TapButtonMap::LeftMiddleRight),2720 tap_button_map: Some(TapButtonMap::LeftMiddleRight),
2714 left_handed: false,2721 left_handed: false,
2715 disabled_on_external_mouse: true,2722 disabled_on_external_mouse: true,
2723+ middle_emulation: false,
2716 },2724 },
2717 mouse: Mouse {2725 mouse: Mouse {
2718 off: false,2726 off: false,
@@ -2721,6 +2729,7 @@ mod tests {
2721 accel_profile: Some(AccelProfile::Flat),2729 accel_profile: Some(AccelProfile::Flat),
2722 scroll_method: Some(ScrollMethod::NoScroll),2730 scroll_method: Some(ScrollMethod::NoScroll),
2723 left_handed: false,2731 left_handed: false,
2732+ middle_emulation: true,
2724 },2733 },
2725 trackpoint: Trackpoint {2734 trackpoint: Trackpoint {
2726 off: true,2735 off: true,
@@ -2728,6 +2737,7 @@ mod tests {
2728 accel_speed: 0.0,2737 accel_speed: 0.0,
2729 accel_profile: Some(AccelProfile::Flat),2738 accel_profile: Some(AccelProfile::Flat),
2730 scroll_method: Some(ScrollMethod::OnButtonDown),2739 scroll_method: Some(ScrollMethod::OnButtonDown),
2740+ middle_emulation: false,
2731 },2741 },
2732 tablet: Tablet {2742 tablet: Tablet {
2733 off: false,2743 off: false,
src/input/mod.rsmodified+3 -0
@@ -2424,6 +2424,7 @@ pub fn apply_libinput_settings(config: &niri_config::Input, device: &mut input::
2424 let _ = device.config_scroll_set_natural_scroll_enabled(c.natural_scroll);2424 let _ = device.config_scroll_set_natural_scroll_enabled(c.natural_scroll);
2425 let _ = device.config_accel_set_speed(c.accel_speed);2425 let _ = device.config_accel_set_speed(c.accel_speed);
2426 let _ = device.config_left_handed_set(c.left_handed);2426 let _ = device.config_left_handed_set(c.left_handed);
2427+ let _ = device.config_middle_emulation_set_enabled(c.middle_emulation);
2427 2428
2428 if let Some(accel_profile) = c.accel_profile {2429 if let Some(accel_profile) = c.accel_profile {
2429 let _ = device.config_accel_set_profile(accel_profile.into());2430 let _ = device.config_accel_set_profile(accel_profile.into());
@@ -2479,6 +2480,7 @@ pub fn apply_libinput_settings(config: &niri_config::Input, device: &mut input::
2479 let _ = device.config_scroll_set_natural_scroll_enabled(c.natural_scroll);2480 let _ = device.config_scroll_set_natural_scroll_enabled(c.natural_scroll);
2480 let _ = device.config_accel_set_speed(c.accel_speed);2481 let _ = device.config_accel_set_speed(c.accel_speed);
2481 let _ = device.config_left_handed_set(c.left_handed);2482 let _ = device.config_left_handed_set(c.left_handed);
2483+ let _ = device.config_middle_emulation_set_enabled(c.middle_emulation);
2482 2484
2483 if let Some(accel_profile) = c.accel_profile {2485 if let Some(accel_profile) = c.accel_profile {
2484 let _ = device.config_accel_set_profile(accel_profile.into());2486 let _ = device.config_accel_set_profile(accel_profile.into());
@@ -2502,6 +2504,7 @@ pub fn apply_libinput_settings(config: &niri_config::Input, device: &mut input::
2502 });2504 });
2503 let _ = device.config_scroll_set_natural_scroll_enabled(c.natural_scroll);2505 let _ = device.config_scroll_set_natural_scroll_enabled(c.natural_scroll);
2504 let _ = device.config_accel_set_speed(c.accel_speed);2506 let _ = device.config_accel_set_speed(c.accel_speed);
2507+ let _ = device.config_middle_emulation_set_enabled(c.middle_emulation);
2505 2508
2506 if let Some(accel_profile) = c.accel_profile {2509 if let Some(accel_profile) = c.accel_profile {
2507 let _ = device.config_accel_set_profile(accel_profile.into());2510 let _ = device.config_accel_set_profile(accel_profile.into());
wiki/Configuration:-Input.mdmodified+4 -0
@@ -37,6 +37,7 @@ input {
37 // click-method "clickfinger"37 // click-method "clickfinger"
38 // left-handed38 // left-handed
39 // disabled-on-external-mouse39 // disabled-on-external-mouse
40+ // middle-emulation
40 }41 }
41 42
42 mouse {43 mouse {
@@ -46,6 +47,7 @@ input {
46 // accel-profile "flat"47 // accel-profile "flat"
47 // scroll-method "no-scroll"48 // scroll-method "no-scroll"
48 // left-handed49 // left-handed
50+ // middle-emulation
49 }51 }
50 52
51 trackpoint {53 trackpoint {
@@ -54,6 +56,7 @@ input {
54 // accel-speed 0.256 // accel-speed 0.2
55 // accel-profile "flat"57 // accel-profile "flat"
56 // scroll-method "on-button-down"58 // scroll-method "on-button-down"
59+ // middle-emulation
57 }60 }
58 61
59 tablet {62 tablet {
@@ -138,6 +141,7 @@ A few settings are common between `touchpad`, `mouse` and `trackpoint`:
138 - `accel-profile`: can be `adaptive` (the default) or `flat` (disables pointer acceleration).141 - `accel-profile`: can be `adaptive` (the default) or `flat` (disables pointer acceleration).
139 - `scroll-method`: when to generate scroll events instead of pointer motion events, can be `no-scroll`, `two-finger`, `edge`, or `on-button-down`.142 - `scroll-method`: when to generate scroll events instead of pointer motion events, can be `no-scroll`, `two-finger`, `edge`, or `on-button-down`.
140 The default and supported methods vary depending on the device type.143 The default and supported methods vary depending on the device type.
144+- `middle-emulation`: emulate a middle mouse click by pressing left and right mouse buttons at once.
141 145
142 Settings specific to `touchpad`s:146 Settings specific to `touchpad`s:
143 147