mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-23 02:05:33 +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 {
|
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.
|
||||||
|
|||||||
@@ -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,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -3582,9 +3582,13 @@ 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();
|
||||||
|
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();
|
let map_to_output = config.input.tablet.map_to_output.as_ref();
|
||||||
map_to_output.and_then(|name| self.output_by_name_match(name))
|
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> {
|
||||||
let config = self.config.borrow();
|
let config = self.config.borrow();
|
||||||
|
|||||||
Reference in New Issue
Block a user