diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2023-10-03 17:02:07 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2023-10-03 17:02:07 +0400 |
| commit | 1bcc889e6232515a12f38738418586f03ea8c8c6 (patch) | |
| tree | 7d48643d6a1656b01b78dd26883f3b39dbe95bdf | |
| parent | 7bb1c114a2f29f339f547e226cfd7d3af47f414f (diff) | |
| download | niri-1bcc889e6232515a12f38738418586f03ea8c8c6.tar.gz niri-1bcc889e6232515a12f38738418586f03ea8c8c6.tar.bz2 niri-1bcc889e6232515a12f38738418586f03ea8c8c6.zip | |
Add tablet map-to-output setting
| -rw-r--r-- | resources/default-config.kdl | 9 | ||||
| -rw-r--r-- | src/config.rs | 15 | ||||
| -rw-r--r-- | src/input.rs | 6 | ||||
| -rw-r--r-- | src/niri.rs | 16 |
4 files changed, 40 insertions, 6 deletions
diff --git a/resources/default-config.kdl b/resources/default-config.kdl index a6e3667e..11d225cb 100644 --- a/resources/default-config.kdl +++ b/resources/default-config.kdl @@ -18,13 +18,20 @@ input { // repeat-rate 25 } - // Next sections contain libinput settings. + // Next sections include libinput settings. // Omitting settings disables them, or leaves them at their default values. touchpad { tap natural-scroll // accel-speed 0.2 } + + tablet { + // Set the name of the output (see below) which the tablet will map to. + // If this is unset or the output doesn't exist, the tablet maps to one of the + // existing outputs. + map-to-output "eDP-1" + } } // You can configure outputs by their name, which you can find with wayland-info(1). diff --git a/src/config.rs b/src/config.rs index 9f73518b..730a0f4b 100644 --- a/src/config.rs +++ b/src/config.rs @@ -35,6 +35,8 @@ pub struct Input { pub keyboard: Keyboard, #[knuffel(child, default)] pub touchpad: Touchpad, + #[knuffel(child, default)] + pub tablet: Tablet, } #[derive(knuffel::Decode, Debug, Default, PartialEq, Eq)] @@ -73,6 +75,12 @@ pub struct Touchpad { pub accel_speed: f64, } +#[derive(knuffel::Decode, Debug, Default, PartialEq)] +pub struct Tablet { + #[knuffel(child, unwrap(argument))] + pub map_to_output: Option<String>, +} + #[derive(knuffel::Decode, Debug, Clone, PartialEq)] pub struct Output { #[knuffel(argument)] @@ -478,6 +486,10 @@ mod tests { tap accel-speed 0.2 } + + tablet { + map-to-output "eDP-1" + } } output "eDP-1" { @@ -530,6 +542,9 @@ mod tests { natural_scroll: false, accel_speed: 0.2, }, + tablet: Tablet { + map_to_output: Some("eDP-1".to_owned()), + }, }, outputs: vec