Add tablet option map-to-focused-output

This commit is contained in:
Benjamin Bäumler
2026-01-23 18:28:03 +01:00
committed by Ivan Molodetskikh
parent f4ebbc8017
commit 9e5716a9db
4 changed files with 15 additions and 2 deletions
+5
View File
@@ -89,6 +89,7 @@ input {
tablet { tablet {
// off // off
map-to-output "eDP-1" map-to-output "eDP-1"
// map-to-focused-output
// left-handed // left-handed
// calibration-matrix 1.0 0.0 0.0 0.0 1.0 0.0 // calibration-matrix 1.0 0.0 0.0 0.0 1.0 0.0
} }
@@ -281,6 +282,10 @@ Valid output names are the same as the ones used for output configuration.
<sup>Since: 0.1.7</sup> When a tablet is not mapped to any output, it will map to the union of all connected outputs, without aspect ratio correction. <sup>Since: 0.1.7</sup> When a tablet is not mapped to any output, it will map to the union of all connected outputs, without aspect ratio correction.
Setting specific to `tablet`:
- `map-to-focused-output`: <sup>Since: next release</sup> will map the tablet to the focused output, takes precedence over `map-to-output`.
### General Settings ### General Settings
These settings are not specific to a particular input device. These settings are not specific to a particular input device.
+2
View File
@@ -364,6 +364,8 @@ pub struct Tablet {
#[knuffel(child, unwrap(argument))] #[knuffel(child, unwrap(argument))]
pub map_to_output: Option<String>, pub map_to_output: Option<String>,
#[knuffel(child)] #[knuffel(child)]
pub map_to_focused_output: bool,
#[knuffel(child)]
pub left_handed: bool, pub left_handed: bool,
} }
+2
View File
@@ -705,6 +705,7 @@ mod tests {
tablet { tablet {
map-to-output "eDP-1" map-to-output "eDP-1"
map-to-focused-output
calibration-matrix 1.0 2.0 3.0 \ calibration-matrix 1.0 2.0 3.0 \
4.0 5.0 6.0 4.0 5.0 6.0
} }
@@ -1097,6 +1098,7 @@ mod tests {
map_to_output: Some( map_to_output: Some(
"eDP-1", "eDP-1",
), ),
map_to_focused_output: true,
left_handed: false, left_handed: false,
}, },
touch: Touch { touch: Touch {
+6 -2
View File
@@ -3582,8 +3582,12 @@ impl Niri {
pub fn output_for_tablet(&self) -> Option<&Output> { pub fn output_for_tablet(&self) -> Option<&Output> {
let config = self.config.borrow(); let config = self.config.borrow();
let map_to_output = config.input.tablet.map_to_output.as_ref(); if config.input.tablet.map_to_focused_output {
map_to_output.and_then(|name| self.output_by_name_match(name)) self.layout.active_output()
} else {
let map_to_output = config.input.tablet.map_to_output.as_ref();
map_to_output.and_then(|name| self.output_by_name_match(name))
}
} }
pub fn output_for_touch(&self) -> Option<&Output> { pub fn output_for_touch(&self) -> Option<&Output> {