mirror of
https://github.com/YaLTeR/niri.git
synced 2025-07-07 12:05:00 +00:00
Expose libinput Button Scrolling Button Lock Enabled property
This commit is contained in:
parent
ed14e8da84
commit
e0b0b04b44
4 changed files with 62 additions and 2 deletions
|
@ -213,6 +213,8 @@ pub struct Touchpad {
|
|||
pub scroll_method: Option<ScrollMethod>,
|
||||
#[knuffel(child, unwrap(argument))]
|
||||
pub scroll_button: Option<u32>,
|
||||
#[knuffel(child)]
|
||||
pub scroll_button_lock: bool,
|
||||
#[knuffel(child, unwrap(argument, str))]
|
||||
pub tap_button_map: Option<TapButtonMap>,
|
||||
#[knuffel(child)]
|
||||
|
@ -240,6 +242,8 @@ pub struct Mouse {
|
|||
#[knuffel(child, unwrap(argument))]
|
||||
pub scroll_button: Option<u32>,
|
||||
#[knuffel(child)]
|
||||
pub scroll_button_lock: bool,
|
||||
#[knuffel(child)]
|
||||
pub left_handed: bool,
|
||||
#[knuffel(child)]
|
||||
pub middle_emulation: bool,
|
||||
|
@ -262,6 +266,8 @@ pub struct Trackpoint {
|
|||
#[knuffel(child, unwrap(argument))]
|
||||
pub scroll_button: Option<u32>,
|
||||
#[knuffel(child)]
|
||||
pub scroll_button_lock: bool,
|
||||
#[knuffel(child)]
|
||||
pub left_handed: bool,
|
||||
#[knuffel(child)]
|
||||
pub middle_emulation: bool,
|
||||
|
@ -282,6 +288,8 @@ pub struct Trackball {
|
|||
#[knuffel(child, unwrap(argument))]
|
||||
pub scroll_button: Option<u32>,
|
||||
#[knuffel(child)]
|
||||
pub scroll_button_lock: bool,
|
||||
#[knuffel(child)]
|
||||
pub left_handed: bool,
|
||||
#[knuffel(child)]
|
||||
pub middle_emulation: bool,
|
||||
|
@ -3954,6 +3962,7 @@ mod tests {
|
|||
accel-profile "flat"
|
||||
scroll-method "two-finger"
|
||||
scroll-button 272
|
||||
scroll-button-lock
|
||||
tap-button-map "left-middle-right"
|
||||
disabled-on-external-mouse
|
||||
scroll-factor 0.9
|
||||
|
@ -3985,6 +3994,7 @@ mod tests {
|
|||
accel-profile "flat"
|
||||
scroll-method "edge"
|
||||
scroll-button 275
|
||||
scroll-button-lock
|
||||
left-handed
|
||||
middle-emulation
|
||||
}
|
||||
|
@ -4235,6 +4245,7 @@ mod tests {
|
|||
scroll_button: Some(
|
||||
272,
|
||||
),
|
||||
scroll_button_lock: true,
|
||||
tap_button_map: Some(
|
||||
LeftMiddleRight,
|
||||
),
|
||||
|
@ -4262,6 +4273,7 @@ mod tests {
|
|||
scroll_button: Some(
|
||||
273,
|
||||
),
|
||||
scroll_button_lock: false,
|
||||
left_handed: false,
|
||||
middle_emulation: true,
|
||||
scroll_factor: Some(
|
||||
|
@ -4285,6 +4297,7 @@ mod tests {
|
|||
scroll_button: Some(
|
||||
274,
|
||||
),
|
||||
scroll_button_lock: false,
|
||||
left_handed: false,
|
||||
middle_emulation: false,
|
||||
},
|
||||
|
@ -4303,6 +4316,7 @@ mod tests {
|
|||
scroll_button: Some(
|
||||
275,
|
||||
),
|
||||
scroll_button_lock: true,
|
||||
left_handed: true,
|
||||
middle_emulation: true,
|
||||
},
|
||||
|
|
|
@ -53,6 +53,7 @@ input {
|
|||
// accel-profile "flat"
|
||||
// scroll-method "on-button-down"
|
||||
// scroll-button 273
|
||||
// scroll-button-lock
|
||||
// middle-emulation
|
||||
}
|
||||
|
||||
|
@ -219,13 +220,13 @@ layout {
|
|||
// radius. It has to assume that windows have square corners, leading to
|
||||
// shadow artifacts inside the CSD rounded corners. This setting fixes
|
||||
// those artifacts.
|
||||
//
|
||||
//
|
||||
// However, instead you may want to set prefer-no-csd and/or
|
||||
// geometry-corner-radius. Then, niri will know the corner radius and
|
||||
// draw the shadow correctly, without having to draw it behind the
|
||||
// window. These will also remove client-side shadows if the window
|
||||
// draws any.
|
||||
//
|
||||
//
|
||||
// draw-behind-window true
|
||||
|
||||
// You can change how shadows look. The values below are in logical
|
||||
|
|
|
@ -4290,6 +4290,11 @@ pub fn apply_libinput_settings(config: &niri_config::Input, device: &mut input::
|
|||
if let Some(button) = c.scroll_button {
|
||||
let _ = device.config_scroll_set_button(button);
|
||||
}
|
||||
let _ = device.config_scroll_set_button_lock(if c.scroll_button_lock {
|
||||
input::ScrollButtonLockState::Enabled
|
||||
} else {
|
||||
input::ScrollButtonLockState::Disabled
|
||||
});
|
||||
}
|
||||
} else if let Some(default) = device.config_scroll_default_method() {
|
||||
let _ = device.config_scroll_set_method(default);
|
||||
|
@ -4298,6 +4303,11 @@ pub fn apply_libinput_settings(config: &niri_config::Input, device: &mut input::
|
|||
if let Some(button) = c.scroll_button {
|
||||
let _ = device.config_scroll_set_button(button);
|
||||
}
|
||||
let _ = device.config_scroll_set_button_lock(if c.scroll_button_lock {
|
||||
input::ScrollButtonLockState::Enabled
|
||||
} else {
|
||||
input::ScrollButtonLockState::Disabled
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4358,6 +4368,11 @@ pub fn apply_libinput_settings(config: &niri_config::Input, device: &mut input::
|
|||
if let Some(button) = c.scroll_button {
|
||||
let _ = device.config_scroll_set_button(button);
|
||||
}
|
||||
let _ = device.config_scroll_set_button_lock(if c.scroll_button_lock {
|
||||
input::ScrollButtonLockState::Enabled
|
||||
} else {
|
||||
input::ScrollButtonLockState::Disabled
|
||||
});
|
||||
}
|
||||
} else if let Some(default) = device.config_scroll_default_method() {
|
||||
let _ = device.config_scroll_set_method(default);
|
||||
|
@ -4366,6 +4381,11 @@ pub fn apply_libinput_settings(config: &niri_config::Input, device: &mut input::
|
|||
if let Some(button) = c.scroll_button {
|
||||
let _ = device.config_scroll_set_button(button);
|
||||
}
|
||||
let _ = device.config_scroll_set_button_lock(if c.scroll_button_lock {
|
||||
input::ScrollButtonLockState::Enabled
|
||||
} else {
|
||||
input::ScrollButtonLockState::Disabled
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4395,6 +4415,11 @@ pub fn apply_libinput_settings(config: &niri_config::Input, device: &mut input::
|
|||
if let Some(button) = c.scroll_button {
|
||||
let _ = device.config_scroll_set_button(button);
|
||||
}
|
||||
let _ = device.config_scroll_set_button_lock(if c.scroll_button_lock {
|
||||
input::ScrollButtonLockState::Enabled
|
||||
} else {
|
||||
input::ScrollButtonLockState::Disabled
|
||||
});
|
||||
}
|
||||
} else if let Some(default) = device.config_scroll_default_method() {
|
||||
let _ = device.config_scroll_set_method(default);
|
||||
|
@ -4403,6 +4428,11 @@ pub fn apply_libinput_settings(config: &niri_config::Input, device: &mut input::
|
|||
if let Some(button) = c.scroll_button {
|
||||
let _ = device.config_scroll_set_button(button);
|
||||
}
|
||||
let _ = device.config_scroll_set_button_lock(if c.scroll_button_lock {
|
||||
input::ScrollButtonLockState::Enabled
|
||||
} else {
|
||||
input::ScrollButtonLockState::Disabled
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4432,6 +4462,11 @@ pub fn apply_libinput_settings(config: &niri_config::Input, device: &mut input::
|
|||
if let Some(button) = c.scroll_button {
|
||||
let _ = device.config_scroll_set_button(button);
|
||||
}
|
||||
let _ = device.config_scroll_set_button_lock(if c.scroll_button_lock {
|
||||
input::ScrollButtonLockState::Enabled
|
||||
} else {
|
||||
input::ScrollButtonLockState::Disabled
|
||||
});
|
||||
}
|
||||
} else if let Some(default) = device.config_scroll_default_method() {
|
||||
let _ = device.config_scroll_set_method(default);
|
||||
|
@ -4440,6 +4475,11 @@ pub fn apply_libinput_settings(config: &niri_config::Input, device: &mut input::
|
|||
if let Some(button) = c.scroll_button {
|
||||
let _ = device.config_scroll_set_button(button);
|
||||
}
|
||||
let _ = device.config_scroll_set_button_lock(if c.scroll_button_lock {
|
||||
input::ScrollButtonLockState::Enabled
|
||||
} else {
|
||||
input::ScrollButtonLockState::Disabled
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ input {
|
|||
// scroll-factor 1.0
|
||||
// scroll-method "two-finger"
|
||||
// scroll-button 273
|
||||
// scroll-button-lock
|
||||
// tap-button-map "left-middle-right"
|
||||
// click-method "clickfinger"
|
||||
// left-handed
|
||||
|
@ -54,6 +55,7 @@ input {
|
|||
// scroll-factor 1.0
|
||||
// scroll-method "no-scroll"
|
||||
// scroll-button 273
|
||||
// scroll-button-lock
|
||||
// left-handed
|
||||
// middle-emulation
|
||||
}
|
||||
|
@ -65,6 +67,7 @@ input {
|
|||
// accel-profile "flat"
|
||||
// scroll-method "on-button-down"
|
||||
// scroll-button 273
|
||||
// scroll-button-lock
|
||||
// left-handed
|
||||
// middle-emulation
|
||||
}
|
||||
|
@ -76,6 +79,7 @@ input {
|
|||
// accel-profile "flat"
|
||||
// scroll-method "on-button-down"
|
||||
// scroll-button 273
|
||||
// scroll-button-lock
|
||||
// left-handed
|
||||
// middle-emulation
|
||||
}
|
||||
|
@ -201,6 +205,7 @@ A few settings are common between `touchpad`, `mouse`, `trackpoint`, and `trackb
|
|||
- `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.
|
||||
- `scroll-button`: <sup>Since: 0.1.10</sup> the button code used for the `on-button-down` scroll method. You can find it in `libinput debug-events`.
|
||||
- `scroll-button-lock`: <sup>Since: next release</sup> when enabled, the button does not need to be held down. Pressing once engages scrolling, pressing a second time disengages it, and double click acts as single click of the the underlying button.
|
||||
- `left-handed`: if set, changes the device to left-handed mode.
|
||||
- `middle-emulation`: emulate a middle mouse click by pressing left and right mouse buttons at once.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue