mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-24 02:01:18 +07:00
Add tablet option map-to-focused-output
This commit is contained in:
committed by
Ivan Molodetskikh
parent
f4ebbc8017
commit
9e5716a9db
@@ -89,6 +89,7 @@ input {
|
||||
tablet {
|
||||
// off
|
||||
map-to-output "eDP-1"
|
||||
// map-to-focused-output
|
||||
// left-handed
|
||||
// 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.
|
||||
|
||||
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
|
||||
|
||||
These settings are not specific to a particular input device.
|
||||
|
||||
@@ -364,6 +364,8 @@ pub struct Tablet {
|
||||
#[knuffel(child, unwrap(argument))]
|
||||
pub map_to_output: Option<String>,
|
||||
#[knuffel(child)]
|
||||
pub map_to_focused_output: bool,
|
||||
#[knuffel(child)]
|
||||
pub left_handed: bool,
|
||||
}
|
||||
|
||||
|
||||
@@ -705,6 +705,7 @@ mod tests {
|
||||
|
||||
tablet {
|
||||
map-to-output "eDP-1"
|
||||
map-to-focused-output
|
||||
calibration-matrix 1.0 2.0 3.0 \
|
||||
4.0 5.0 6.0
|
||||
}
|
||||
@@ -1097,6 +1098,7 @@ mod tests {
|
||||
map_to_output: Some(
|
||||
"eDP-1",
|
||||
),
|
||||
map_to_focused_output: true,
|
||||
left_handed: false,
|
||||
},
|
||||
touch: Touch {
|
||||
|
||||
+6
-2
@@ -3582,8 +3582,12 @@ impl Niri {
|
||||
|
||||
pub fn output_for_tablet(&self) -> Option<&Output> {
|
||||
let config = self.config.borrow();
|
||||
let map_to_output = config.input.tablet.map_to_output.as_ref();
|
||||
map_to_output.and_then(|name| self.output_by_name_match(name))
|
||||
if config.input.tablet.map_to_focused_output {
|
||||
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> {
|
||||
|
||||
Reference in New Issue
Block a user