aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-07-13 07:34:22 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2024-07-13 07:34:22 +0300
commit2e906fc5fa9db0aa69cded149732d62b4b219aee (patch)
tree914639c533c65bc4da54c33f8b320e999d7bdb7b
parenta5a34934df2a6af21a608eb4d6865c234d7381e8 (diff)
downloadniri-2e906fc5fa9db0aa69cded149732d62b4b219aee.tar.gz
niri-2e906fc5fa9db0aa69cded149732d62b4b219aee.tar.bz2
niri-2e906fc5fa9db0aa69cded149732d62b4b219aee.zip
Add middle-emulation libinput flag
-rw-r--r--niri-config/src/lib.rs10
-rw-r--r--src/input/mod.rs3
-rw-r--r--wiki/Configuration:-Input.md4
3 files changed, 17 insertions, 0 deletions
diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs
index d2343ff9..e5998bfb 100644
--- a/niri-config/src/lib.rs
+++ b/niri-config/src/lib.rs
@@ -177,6 +177,8 @@ pub struct Touchpad {
pub left_handed: bool,
#[knuffel(child)]
pub disabled_on_external_mouse: bool,
+ #[knuffel(child)]
+ pub middle_emulation: bool,
}
#[derive(knuffel::Decode, Debug, Default, PartialEq)]
@@ -193,6 +195,8 @@ pub struct Mouse {
pub scroll_method: Option<ScrollMethod>,
#[knuffel(child)]
pub left_handed: bool,
+ #[knuffel(child)]
+ pub middle_emulation: bool,
}
#[derive(knuffel::Decode, Debug, Default, PartialEq)]
@@ -207,6 +211,8 @@ pub struct Trackpoint {
pub accel_profile: Option<AccelProfile>,
#[knuffel(child, unwrap(argument, str))]
pub scroll_method: Option<ScrollMethod>,
+ #[knuffel(child)]
+ pub middle_emulation: bool,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -2545,6 +2551,7 @@ mod tests {
accel-speed 0.4
accel-profile "flat"
scroll-method "no-scroll"
+ middle-emulation
}
trackpoint {
@@ -2713,6 +2720,7 @@ mod tests {
tap_button_map: Some(TapButtonMap::LeftMiddleRight),
left_handed: false,
disabled_on_external_mouse: true,
+ middle_emulation: false,
},
mouse: Mouse {
off: false,
@@ -2721,6 +2729,7 @@ mod tests {
accel_profile: Some(AccelProfile::Flat),
scroll_method: Some(ScrollMethod::NoScroll),
left_handed: false,
+ middle_emulation: true,
},
trackpoint: Trackpoint {
off: true,
@@ -2728,6 +2737,7 @@ mod tests {
accel_speed: 0.0,
accel_profile: Some(AccelProfile::Flat),
scroll_method: Some(ScrollMethod::OnButtonDown),
+ middle_emulation: false,
},
tablet: Tablet {
off: false,
diff --git a/src/input/mod.rs b/src/input/mod.rs
index 148129cf..4af68edf 100644
--- a/src/input/mod.rs
+++ b/src/input/mod.rs
@@ -2424,6 +2424,7 @@ pub fn apply_libinput_settings(config: &niri_config::Input, device: &mut input::
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);
+ let _ = device.config_middle_emulation_set_enabled(c.middle_emulation);
if let Some(accel_profile) = c.accel_profile {
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::
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);
+ let _ = device.config_middle_emulation_set_enabled(c.middle_emulation);
if let Some(accel_profile) = c.accel_profile {
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::
});
let _ = device.config_scroll_set_natural_scroll_enabled(c.natural_scroll);
let _ = device.config_accel_set_speed(c.accel_speed);
+ let _ = device.config_middle_emulation_set_enabled(c.middle_emulation);
if let Some(accel_profile) = c.accel_profile {
let _ = device.config_accel_set_profile(accel_profile.into());
diff --git a/wiki/Configuration:-Input.md b/wiki/Configuration:-Input.md
index bb000170..4c824b9a 100644
--- a/wiki/Configuration:-Input.md
+++ b/wiki/Configuration:-Input.md
@@ -37,6 +37,7 @@ input {
// click-method "clickfinger"
// left-handed
// disabled-on-external-mouse
+ // middle-emulation
}
mouse {
@@ -46,6 +47,7 @@ input {
// accel-profile "flat"
// scroll-method "no-scroll"
// left-handed
+ // middle-emulation
}
trackpoint {
@@ -54,6 +56,7 @@ input {
// accel-speed 0.2
// accel-profile "flat"
// scroll-method "on-button-down"
+ // middle-emulation
}
tablet {
@@ -138,6 +141,7 @@ A few settings are common between `touchpad`, `mouse` and `trackpoint`:
- `accel-profile`: can be `adaptive` (the default) or `flat` (disables pointer acceleration).
- `scroll-method`: when to generate scroll events instead of pointer motion events, can be `no-scroll`, `two-finger`, `edge`, or `on-button-down`.
The default and supported methods vary depending on the device type.
+- `middle-emulation`: emulate a middle mouse click by pressing left and right mouse buttons at once.
Settings specific to `touchpad`s: