diff --git a/docs/wiki/Configuration:-Input.md b/docs/wiki/Configuration:-Input.md
index 9af94dca..911b28bf 100644
--- a/docs/wiki/Configuration:-Input.md
+++ b/docs/wiki/Configuration:-Input.md
@@ -36,6 +36,7 @@ input {
natural-scroll
// accel-speed 0.2
// accel-profile "flat"
+ // pinch-sensitivity 1.0
// scroll-factor 1.0
// scroll-factor vertical=1.0 horizontal=-2.0
// scroll-method "two-finger"
@@ -244,6 +245,8 @@ A few settings are common between `touchpad`, `mouse`, `trackpoint`, and `trackb
Settings specific to `touchpad`s:
+- `pinch-sensitivity`: Since: next release scales the sensitivity of pinch gestures sent to applications.
+ Values above `1.0` increase sensitivity, while values below `1.0` decrease it.
- `tap`: tap-to-click.
- `dwt`: disable-when-typing.
- `dwtp`: disable-when-trackpointing.
diff --git a/docs/wiki/Configuration:-Window-Rules.md b/docs/wiki/Configuration:-Window-Rules.md
index b04bfcd0..48a57492 100644
--- a/docs/wiki/Configuration:-Window-Rules.md
+++ b/docs/wiki/Configuration:-Window-Rules.md
@@ -58,6 +58,7 @@ window-rule {
default-column-display "tabbed"
default-floating-position x=100 y=200 relative-to="bottom-left"
scroll-factor 0.75
+ pinch-sensitivity 1.25
on-xdg-activate "focus"
focus-ring {
@@ -758,6 +759,23 @@ window-rule {
}
```
+#### `pinch-sensitivity`
+
+Since: next release
+
+Set the sensitivity of pinch gestures sent to a window.
+
+This will be multiplied with the pinch sensitivity set for your touchpad in the [input section](./Configuration:-Input.md#pointing-devices).
+
+```kdl
+// Make pinch gestures in Firefox more sensitive.
+window-rule {
+ match app-id="firefox$"
+
+ pinch-sensitivity 1.25
+}
+```
+
#### `draw-border-with-background`
Override whether the border and the focus ring draw with a background.
diff --git a/niri-config/src/input.rs b/niri-config/src/input.rs
index 5a2eb136..78e3ed21 100644
--- a/niri-config/src/input.rs
+++ b/niri-config/src/input.rs
@@ -221,6 +221,8 @@ pub struct Touchpad {
pub middle_emulation: bool,
#[knuffel(child)]
pub scroll_factor: Option,
+ #[knuffel(child, unwrap(argument))]
+ pub pinch_sensitivity: Option>,
}
#[derive(knuffel::Decode, Debug, Default, Clone, PartialEq)]
diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs
index c78c06bb..bcab6558 100644
--- a/niri-config/src/lib.rs
+++ b/niri-config/src/lib.rs
@@ -708,6 +708,7 @@ mod tests {
tap-button-map "left-middle-right"
disabled-on-external-mouse
scroll-factor 0.9
+ pinch-sensitivity 1.8
}
mouse {
@@ -930,6 +931,8 @@ mod tests {
tab-indicator {
active-color "#f00"
}
+
+ pinch-sensitivity 1.2
}
layer-rule {
@@ -1055,6 +1058,11 @@ mod tests {
vertical: None,
},
),
+ pinch_sensitivity: Some(
+ FloatOrInt(
+ 1.8,
+ ),
+ ),
},
mouse: Mouse {
off: false,
@@ -1909,6 +1917,11 @@ mod tests {
},
),
scroll_factor: None,
+ pinch_sensitivity: Some(
+ FloatOrInt(
+ 1.2,
+ ),
+ ),
tiled_state: None,
background_effect: BackgroundEffectRule {
xray: None,
diff --git a/niri-config/src/window_rule.rs b/niri-config/src/window_rule.rs
index 0aeae2cc..acc9e2e5 100644
--- a/niri-config/src/window_rule.rs
+++ b/niri-config/src/window_rule.rs
@@ -76,6 +76,8 @@ pub struct WindowRule {
#[knuffel(child, unwrap(argument))]
pub scroll_factor: Option>,
#[knuffel(child, unwrap(argument))]
+ pub pinch_sensitivity: Option>,
+ #[knuffel(child, unwrap(argument))]
pub tiled_state: Option,
#[knuffel(child, default)]
pub background_effect: BackgroundEffectRule,
diff --git a/resources/default-config.kdl b/resources/default-config.kdl
index 28b45cf7..1c4fc0e5 100644
--- a/resources/default-config.kdl
+++ b/resources/default-config.kdl
@@ -38,6 +38,7 @@ input {
natural-scroll
// accel-speed 0.2
// accel-profile "flat"
+ // pinch-sensitivity 1.0
// scroll-method "two-finger"
// disabled-on-external-mouse
}
diff --git a/src/input/mod.rs b/src/input/mod.rs
index 183909ee..488e2688 100644
--- a/src/input/mod.rs
+++ b/src/input/mod.rs
@@ -4179,12 +4179,29 @@ impl State {
pointer.frame(self);
}
+ let input_sensitivity = self
+ .niri
+ .config
+ .borrow()
+ .input
+ .touchpad
+ .pinch_sensitivity
+ .map(|x| x.0)
+ .unwrap_or(1.);
+ let window_sensitivity = pointer
+ .current_focus()
+ .map(|focused| self.niri.find_root_shell_surface(&focused))
+ .and_then(|root| self.niri.layout.find_window_and_output(&root).unzip().0)
+ .and_then(|window| window.rules().pinch_sensitivity)
+ .unwrap_or(1.);
+ let sensitivity = input_sensitivity * window_sensitivity;
+
pointer.gesture_pinch_update(
self,
&GesturePinchUpdateEvent {
time: event.time(),
delta: event.delta(),
- scale: event.scale(),
+ scale: event.scale().powf(sensitivity),
rotation: event.rotation(),
},
);
diff --git a/src/window/mod.rs b/src/window/mod.rs
index 1134510e..771f0d95 100644
--- a/src/window/mod.rs
+++ b/src/window/mod.rs
@@ -120,6 +120,9 @@ pub struct ResolvedWindowRules {
/// Multiplier for all scroll events sent to this window.
pub scroll_factor: Option,
+ /// Pinch gesture sensitivity for this window.
+ pub pinch_sensitivity: Option,
+
/// Override whether to set the Tiled xdg-toplevel state on the window.
pub tiled_state: Option,
@@ -306,6 +309,9 @@ impl ResolvedWindowRules {
if let Some(x) = rule.scroll_factor {
resolved.scroll_factor = Some(x.0);
}
+ if let Some(x) = rule.pinch_sensitivity {
+ resolved.pinch_sensitivity = Some(x.0);
+ }
if let Some(x) = rule.tiled_state {
resolved.tiled_state = Some(x);
}