forge
Explore
Log in

Don't you dare go Hollow

niri

Clone
★ 0

0 watching0 forksRustGPL-3.012.1 MiB0411fd8Ivan Molodetskikh3 years ago263 commits

input.rs748 lines, 31.0 KiBHistoryRawDownload
1use smithay::backend::input::{
2 AbsolutePositionEvent, Axis, AxisSource, ButtonState, Device, DeviceCapability, Event,
3 GestureBeginEvent, GestureEndEvent, GesturePinchUpdateEvent as _, GestureSwipeUpdateEvent as _,
4 InputBackend, InputEvent, KeyState, KeyboardKeyEvent, PointerAxisEvent, PointerButtonEvent,
5 PointerMotionEvent, ProximityState, TabletToolButtonEvent, TabletToolEvent,
6 TabletToolProximityEvent, TabletToolTipEvent, TabletToolTipState,
7};
8use smithay::backend::libinput::LibinputInputBackend;
9use smithay::input::keyboard::{keysyms, FilterResult, KeysymHandle, ModifiersState};
10use smithay::input::pointer::{
11 AxisFrame, ButtonEvent, GestureHoldBeginEvent, GestureHoldEndEvent, GesturePinchBeginEvent,
12 GesturePinchEndEvent, GesturePinchUpdateEvent, GestureSwipeBeginEvent, GestureSwipeEndEvent,
13 GestureSwipeUpdateEvent, MotionEvent, RelativeMotionEvent,
14};
15use smithay::utils::SERIAL_COUNTER;
16use smithay::wayland::tablet_manager::{TabletDescriptor, TabletSeatTrait};
17
18use crate::config::{Action, Config, Modifiers};
19use crate::niri::State;
20use crate::utils::{center, get_monotonic_time, spawn};
21
22pub enum CompositorMod {
23 Super,
24 Alt,
25}
26
27impl From<Action> for FilterResult<Action> {
28 fn from(value: Action) -> Self {
29 match value {
30 Action::None => FilterResult::Forward,
31 action => FilterResult::Intercept(action),
32 }
33 }
34}
35
36fn action(
37 config: &Config,
38 comp_mod: CompositorMod,
39 keysym: KeysymHandle,
40 mods: ModifiersState,
41) -> Action {
42 use keysyms::*;
43
44 // Handle hardcoded binds.
45 #[allow(non_upper_case_globals)] // wat
46 match keysym.modified_sym().raw() {
47 modified @ KEY_XF86Switch_VT_1..=KEY_XF86Switch_VT_12 => {
48 let vt = (modified - KEY_XF86Switch_VT_1 + 1) as i32;
49 return Action::ChangeVt(vt);
50 }
51 KEY_XF86PowerOff => return Action::Suspend,
52 _ => (),
53 }
54
55 // Handle configured binds.
56 let mut modifiers = Modifiers::empty();
57 if mods.ctrl {
58 modifiers |= Modifiers::CTRL;
59 }
60 if mods.shift {
61 modifiers |= Modifiers::SHIFT;
62 }
63 if mods.alt {
64 modifiers |= Modifiers::ALT;
65 }
66 if mods.logo {
67 modifiers |= Modifiers::SUPER;
68 }
69
70 let (mod_down, mut comp_mod) = match comp_mod {
71 CompositorMod::Super => (mods.logo, Modifiers::SUPER),
72 CompositorMod::Alt => (mods.alt, Modifiers::ALT),
73 };
74 if mod_down {
75 modifiers |= Modifiers::COMPOSITOR;
76 } else {
77 comp_mod = Modifiers::empty();
78 }
79
80 let Some(&raw) = keysym.raw_syms().first() else {
81 return Action::None;
82 };
83 for bind in &config.binds.0 {
84 if bind.key.keysym != raw {
85 continue;
86 }
87
88 if bind.key.modifiers | comp_mod == modifiers {
89 return bind.actions.first().cloned().unwrap_or(Action::None);
90 }
91 }
92
93 Action::None
94}
95
96impl State {
97 pub fn process_input_event<I: InputBackend>(&mut self, event: InputEvent<I>) {
98 let _span = tracy_client::span!("process_input_event");
99
100 // A bit of a hack, but animation end runs some logic (i.e. workspace clean-up) and it
101 // doesn't always trigger due to damage, etc. So run it here right before it might prove
102 // important. Besides, animations affect the input, so it's best to have up-to-date values
103 // here.
104 self.niri.layout.advance_animations(get_monotonic_time());
105
106 let comp_mod = self.backend.mod_key();
107
108 match event {
109 InputEvent::Keyboard { event, .. } => {
110 let serial = SERIAL_COUNTER.next_serial();
111 let time = Event::time_msec(&event);
112
113 let action = self.niri.seat.get_keyboard().unwrap().input(
114 self,
115 event.key_code(),
116 event.state(),
117 serial,
118 time,
119 |self_, mods, keysym| {
120 if event.state() == KeyState::Pressed {
121 let config = self_.niri.config.borrow();
122 action(&config, comp_mod, keysym, *mods).into()
123 } else {
124 FilterResult::Forward
125 }
126 },
127 );
128
129 if let Some(action) = action {
130 match action {
131 Action::None => unreachable!(),
132 Action::Quit => {
133 info!("quitting because quit bind was pressed");
134 self.niri.stop_signal.stop()
135 }
136 Action::ChangeVt(vt) => {
137 self.backend.change_vt(vt);
138 }
139 Action::Suspend => {
140 self.backend.suspend();
141 }
142 Action::ToggleDebugTint => {
143 self.backend.toggle_debug_tint();
144 }
145 Action::Spawn(command) => {
146 if let Some((command, args)) = command.split_first() {
147 spawn(command, args);
148 }
149 }
150 Action::Screenshot => {
151 let active = self.niri.layout.active_output().cloned();
152 if let Some(active) = active {
153 if let Some(renderer) = self.backend.renderer() {
154 if let Err(err) = self.niri.screenshot(renderer, &active) {
155 warn!("error taking screenshot: {err:?}");
156 }
157 }
158 }
159 }
160 Action::CloseWindow => {
161 if let Some(window) = self.niri.layout.focus() {
162 window.toplevel().send_close();
163 }
164 }
165 Action::FullscreenWindow => {
166 let focus = self.niri.layout.focus().cloned();
167 if let Some(window) = focus {
168 self.niri.layout.toggle_fullscreen(&window);
169 }
170 }
171 Action::MoveColumnLeft => {
172 self.niri.layout.move_left();
173 // FIXME: granular
174 self.niri.queue_redraw_all();
175 }
176 Action::MoveColumnRight => {
177 self.niri.layout.move_right();
178 // FIXME: granular
179 self.niri.queue_redraw_all();
180 }
181 Action::MoveWindowDown => {
182 self.niri.layout.move_down();
183 // FIXME: granular
184 self.niri.queue_redraw_all();
185 }
186 Action::MoveWindowUp => {
187 self.niri.layout.move_up();
188 // FIXME: granular
189 self.niri.queue_redraw_all();
190 }
191 Action::FocusColumnLeft => {
192 self.niri.layout.focus_left();
193 }
194 Action::FocusColumnRight => {
195 self.niri.layout.focus_right();
196 }
197 Action::FocusWindowDown => {
198 self.niri.layout.focus_down();
199 }
200 Action::FocusWindowUp => {
201 self.niri.layout.focus_up();
202 }
203 Action::MoveWindowToWorkspaceDown => {
204 self.niri.layout.move_to_workspace_down();
205 // FIXME: granular
206 self.niri.queue_redraw_all();
207 }
208 Action::MoveWindowToWorkspaceUp => {
209 self.niri.layout.move_to_workspace_up();
210 // FIXME: granular
211 self.niri.queue_redraw_all();
212 }
213 Action::MoveWindowToWorkspace(idx) => {
214 self.niri.layout.move_to_workspace(idx);
215 // FIXME: granular
216 self.niri.queue_redraw_all();
217 }
218 Action::FocusWorkspaceDown => {
219 self.niri.layout.switch_workspace_down();
220 // FIXME: granular
221 self.niri.queue_redraw_all();
222 }
223 Action::FocusWorkspaceUp => {
224 self.niri.layout.switch_workspace_up();
225 // FIXME: granular
226 self.niri.queue_redraw_all();
227 }
228 Action::FocusWorkspace(idx) => {
229 self.niri.layout.switch_workspace(idx);
230 // FIXME: granular
231 self.niri.queue_redraw_all();
232 }
233 Action::ConsumeWindowIntoColumn => {
234 self.niri.layout.consume_into_column();
235 // FIXME: granular
236 self.niri.queue_redraw_all();
237 }
238 Action::ExpelWindowFromColumn => {
239 self.niri.layout.expel_from_column();
240 // FIXME: granular
241 self.niri.queue_redraw_all();
242 }
243 Action::SwitchPresetColumnWidth => {
244 self.niri.layout.toggle_width();
245 }
246 Action::MaximizeColumn => {
247 self.niri.layout.toggle_full_width();
248 }
249 Action::FocusMonitorLeft => {
250 if let Some(output) = self.niri.output_left() {
251 self.niri.layout.focus_output(&output);
252 self.move_cursor_to_output(&output);
253 }
254 }
255 Action::FocusMonitorRight => {
256 if let Some(output) = self.niri.output_right() {
257 self.niri.layout.focus_output(&output);
258 self.move_cursor_to_output(&output);
259 }
260 }
261 Action::FocusMonitorDown => {
262 if let Some(output) = self.niri.output_down() {
263 self.niri.layout.focus_output(&output);
264 self.move_cursor_to_output(&output);
265 }
266 }
267 Action::FocusMonitorUp => {
268 if let Some(output) = self.niri.output_up() {
269 self.niri.layout.focus_output(&output);
270 self.move_cursor_to_output(&output);
271 }
272 }
273 Action::MoveWindowToMonitorLeft => {
274 if let Some(output) = self.niri.output_left() {
275 self.niri.layout.move_to_output(&output);
276 self.move_cursor_to_output(&output);
277 }
278 }
279 Action::MoveWindowToMonitorRight => {
280 if let Some(output) = self.niri.output_right() {
281 self.niri.layout.move_to_output(&output);
282 self.move_cursor_to_output(&output);
283 }
284 }
285 Action::MoveWindowToMonitorDown => {
286 if let Some(output) = self.niri.output_down() {
287 self.niri.layout.move_to_output(&output);
288 self.move_cursor_to_output(&output);
289 }
290 }
291 Action::MoveWindowToMonitorUp => {
292 if let Some(output) = self.niri.output_up() {
293 self.niri.layout.move_to_output(&output);
294 self.move_cursor_to_output(&output);
295 }
296 }
297 Action::SetColumnWidth(change) => {
298 self.niri.layout.set_column_width(change);
299 }
300 }
301 }
302 }
303 InputEvent::PointerMotion { event, .. } => {
304 // We need an output to be able to move the pointer.
305 if self.niri.global_space.outputs().next().is_none() {
306 return;
307 }
308
309 let serial = SERIAL_COUNTER.next_serial();
310
311 let pointer = self.niri.seat.get_pointer().unwrap();
312
313 let pos = pointer.current_location();
314
315 // We have an output, so we can compute the new location and focus.
316 let mut new_pos = pos + event.delta();
317
318 if self
319 .niri
320 .global_space
321 .output_under(new_pos)
322 .next()
323 .is_none()
324 {
325 // We ended up outside the outputs and need to clip the movement.
326 if let Some(output) = self.niri.global_space.output_under(pos).next() {
327 // The pointer was previously on some output. Clip the movement against its
328 // boundaries.
329 let geom = self.niri.global_space.output_geometry(output).unwrap();
330 new_pos.x = new_pos
331 .x
332 .clamp(geom.loc.x as f64, (geom.loc.x + geom.size.w - 1) as f64);
333 new_pos.y = new_pos
334 .y
335 .clamp(geom.loc.y as f64, (geom.loc.y + geom.size.h - 1) as f64);
336 } else {
337 // The pointer was not on any output in the first place. Find one for it.
338 // Let's do the simple thing and just put it on the first output.
339 let output = self.niri.global_space.outputs().next().unwrap();
340 let geom = self.niri.global_space.output_geometry(output).unwrap();
341 new_pos = center(geom).to_f64();
342 }
343 }
344
345 let under = self.niri.surface_under_and_global_space(new_pos);
346
347 pointer.motion(
348 self,
349 under.clone(),
350 &MotionEvent {
351 location: new_pos,
352 serial,
353 time: event.time_msec(),
354 },
355 );
356
357 pointer.relative_motion(
358 self,
359 under,
360 &RelativeMotionEvent {
361 delta: event.delta(),
362 delta_unaccel: event.delta_unaccel(),
363 utime: event.time(),
364 },
365 );
366
367 pointer.frame(self);
368
369 // Redraw to update the cursor position.
370 // FIXME: redraw only outputs overlapping the cursor.
371 self.niri.queue_redraw_all();
372 }
373 InputEvent::PointerMotionAbsolute { event, .. } => {
374 let Some(output) = self.niri.global_space.outputs().next() else {
375 return;
376 };
377
378 let output_geo = self.niri.global_space.output_geometry(output).unwrap();
379
380 let pos = event.position_transformed(output_geo.size) + output_geo.loc.to_f64();
381
382 let serial = SERIAL_COUNTER.next_serial();
383
384 let pointer = self.niri.seat.get_pointer().unwrap();
385
386 let under = self.niri.surface_under_and_global_space(pos);
387
388 pointer.motion(
389 self,
390 under,
391 &MotionEvent {
392 location: pos,
393 serial,
394 time: event.time_msec(),
395 },
396 );
397
398 pointer.frame(self);
399
400 // Redraw to update the cursor position.
401 // FIXME: redraw only outputs overlapping the cursor.
402 self.niri.queue_redraw_all();
403 }
404 InputEvent::PointerButton { event, .. } => {
405 let pointer = self.niri.seat.get_pointer().unwrap();
406
407 let serial = SERIAL_COUNTER.next_serial();
408
409 let button = event.button_code();
410
411 let button_state = event.state();
412
413 if ButtonState::Pressed == button_state && !pointer.is_grabbed() {
414 if let Some(window) = self.niri.window_under_cursor() {
415 let window = window.clone();
416 self.niri.layout.activate_window(&window);
417 } else if let Some(output) = self.niri.output_under_cursor() {
418 self.niri.layout.activate_output(&output);
419 }
420 };
421
422 pointer.button(
423 self,
424 &ButtonEvent {
425 button,
426 state: button_state,
427 serial,
428 time: event.time_msec(),
429 },
430 );
431 pointer.frame(self);
432 }
433 InputEvent::PointerAxis { event, .. } => {
434 let source = event.source();
435
436 let horizontal_amount = event.amount(Axis::Horizontal).unwrap_or_else(|| {
437 event.amount_discrete(Axis::Horizontal).unwrap_or(0.0) * 3.0
438 });
439 let vertical_amount = event
440 .amount(Axis::Vertical)
441 .unwrap_or_else(|| event.amount_discrete(Axis::Vertical).unwrap_or(0.0) * 3.0);
442 let horizontal_amount_discrete = event.amount_discrete(Axis::Horizontal);
443 let vertical_amount_discrete = event.amount_discrete(Axis::Vertical);
444
445 let mut frame = AxisFrame::new(event.time_msec()).source(source);
446 if horizontal_amount != 0.0 {
447 frame = frame.value(Axis::Horizontal, horizontal_amount);
448 if let Some(discrete) = horizontal_amount_discrete {
449 frame = frame.discrete(Axis::Horizontal, discrete as i32);
450 }
451 }
452 if vertical_amount != 0.0 {
453 frame = frame.value(Axis::Vertical, vertical_amount);
454 if let Some(discrete) = vertical_amount_discrete {
455 frame = frame.discrete(Axis::Vertical, discrete as i32);
456 }
457 }
458
459 if source == AxisSource::Finger {
460 if event.amount(Axis::Horizontal) == Some(0.0) {
461 frame = frame.stop(Axis::Horizontal);
462 }
463 if event.amount(Axis::Vertical) == Some(0.0) {
464 frame = frame.stop(Axis::Vertical);
465 }
466 }
467
468 let pointer = &self.niri.seat.get_pointer().unwrap();
469 pointer.axis(self, frame);
470 pointer.frame(self);
471 }
472 InputEvent::TabletToolAxis { event, .. } => {
473 let Some(output) = self.niri.output_for_tablet() else {
474 return;
475 };
476
477 let output_geo = self.niri.global_space.output_geometry(output).unwrap();
478
479 let pos = event.position_transformed(output_geo.size) + output_geo.loc.to_f64();
480
481 let serial = SERIAL_COUNTER.next_serial();
482
483 let pointer = self.niri.seat.get_pointer().unwrap();
484
485 let under = self.niri.surface_under_and_global_space(pos);
486
487 pointer.motion(
488 self,
489 under.clone(),
490 &MotionEvent {
491 location: pos,
492 serial,
493 time: event.time_msec(),
494 },
495 );
496 pointer.frame(self);
497
498 let tablet_seat = self.niri.seat.tablet_seat();
499 let tablet = tablet_seat.get_tablet(&TabletDescriptor::from(&event.device()));
500 let tool = tablet_seat.get_tool(&event.tool());
501 if let (Some(tablet), Some(tool)) = (tablet, tool) {
502 if event.pressure_has_changed() {
503 tool.pressure(event.pressure());
504 }
505 if event.distance_has_changed() {
506 tool.distance(event.distance());
507 }
508 if event.tilt_has_changed() {
509 tool.tilt(event.tilt());
510 }
511 if event.slider_has_changed() {
512 tool.slider_position(event.slider_position());
513 }
514 if event.rotation_has_changed() {
515 tool.rotation(event.rotation());
516 }
517 if event.wheel_has_changed() {
518 tool.wheel(event.wheel_delta(), event.wheel_delta_discrete());
519 }
520
521 tool.motion(
522 pos,
523 under,
524 &tablet,
525 SERIAL_COUNTER.next_serial(),
526 event.time_msec(),
527 );
528 }
529
530 // Redraw to update the cursor position.
531 // FIXME: redraw only outputs overlapping the cursor.
532 self.niri.queue_redraw_all();
533 }
534 InputEvent::TabletToolTip { event, .. } => {
535 let tool = self.niri.seat.tablet_seat().get_tool(&event.tool());
536
537 if let Some(tool) = tool {
538 match event.tip_state() {
539 TabletToolTipState::Down => {
540 let serial = SERIAL_COUNTER.next_serial();
541 tool.tip_down(serial, event.time_msec());
542
543 let pointer = self.niri.seat.get_pointer().unwrap();
544 if !pointer.is_grabbed() {
545 if let Some(window) = self.niri.window_under_cursor() {
546 let window = window.clone();
547 self.niri.layout.activate_window(&window);
548 } else if let Some(output) = self.niri.output_under_cursor() {
549 self.niri.layout.activate_output(&output);
550 }
551 };
552 }
553 TabletToolTipState::Up => {
554 tool.tip_up(event.time_msec());
555 }
556 }
557 }
558 }
559 InputEvent::TabletToolProximity { event, .. } => {
560 let Some(output) = self.niri.output_for_tablet() else {
561 return;
562 };
563
564 let output_geo = self.niri.global_space.output_geometry(output).unwrap();
565
566 let pos = event.position_transformed(output_geo.size) + output_geo.loc.to_f64();
567
568 let serial = SERIAL_COUNTER.next_serial();
569
570 let pointer = self.niri.seat.get_pointer().unwrap();
571
572 let under = self.niri.surface_under_and_global_space(pos);
573
574 pointer.motion(
575 self,
576 under.clone(),
577 &MotionEvent {
578 location: pos,
579 serial,
580 time: event.time_msec(),
581 },
582 );
583 pointer.frame(self);
584
585 let tablet_seat = self.niri.seat.tablet_seat();
586 let tool = tablet_seat.add_tool::<Self>(&self.niri.display_handle, &event.tool());
587 let tablet = tablet_seat.get_tablet(&TabletDescriptor::from(&event.device()));
588 if let (Some(under), Some(tablet)) = (under, tablet) {
589 match event.state() {
590 ProximityState::In => tool.proximity_in(
591 pos,
592 under,
593 &tablet,
594 SERIAL_COUNTER.next_serial(),
595 event.time_msec(),
596 ),
597 ProximityState::Out => tool.proximity_out(event.time_msec()),
598 }
599 }
600 }
601 InputEvent::TabletToolButton { event, .. } => {
602 let tool = self.niri.seat.tablet_seat().get_tool(&event.tool());
603
604 if let Some(tool) = tool {
605 tool.button(
606 event.button(),
607 event.button_state(),
608 SERIAL_COUNTER.next_serial(),
609 event.time_msec(),
610 );
611 }
612 }
613 InputEvent::DeviceAdded { device } => {
614 if device.has_capability(DeviceCapability::TabletTool) {
615 self.niri.seat.tablet_seat().add_tablet::<Self>(
616 &self.niri.display_handle,
617 &TabletDescriptor::from(&device),
618 );
619 }
620 }
621 InputEvent::DeviceRemoved { device } => {
622 if device.has_capability(DeviceCapability::TabletTool) {
623 let tablet_seat = self.niri.seat.tablet_seat();
624
625 tablet_seat.remove_tablet(&TabletDescriptor::from(&device));
626
627 // If there are no tablets in seat we can remove all tools
628 if tablet_seat.count_tablets() == 0 {
629 tablet_seat.clear_tools();
630 }
631 }
632 }
633 InputEvent::GestureSwipeBegin { event } => {
634 let serial = SERIAL_COUNTER.next_serial();
635 let pointer = self.niri.seat.get_pointer().unwrap();
636 pointer.gesture_swipe_begin(
637 self,
638 &GestureSwipeBeginEvent {
639 serial,
640 time: event.time_msec(),
641 fingers: event.fingers(),
642 },
643 );
644 }
645 InputEvent::GestureSwipeUpdate { event } => {
646 let pointer = self.niri.seat.get_pointer().unwrap();
647 pointer.gesture_swipe_update(
648 self,
649 &GestureSwipeUpdateEvent {
650 time: event.time_msec(),
651 delta: event.delta(),
652 },
653 );
654 }
655 InputEvent::GestureSwipeEnd { event } => {
656 let serial = SERIAL_COUNTER.next_serial();
657 let pointer = self.niri.seat.get_pointer().unwrap();
658 pointer.gesture_swipe_end(
659 self,
660 &GestureSwipeEndEvent {
661 serial,
662 time: event.time_msec(),
663 cancelled: event.cancelled(),
664 },
665 );
666 }
667 InputEvent::GesturePinchBegin { event } => {
668 let serial = SERIAL_COUNTER.next_serial();
669 let pointer = self.niri.seat.get_pointer().unwrap();
670 pointer.gesture_pinch_begin(
671 self,
672 &GesturePinchBeginEvent {
673 serial,
674 time: event.time_msec(),
675 fingers: event.fingers(),
676 },
677 );
678 }
679 InputEvent::GesturePinchUpdate { event } => {
680 let pointer = self.niri.seat.get_pointer().unwrap();
681 pointer.gesture_pinch_update(
682 self,
683 &GesturePinchUpdateEvent {
684 time: event.time_msec(),
685 delta: event.delta(),
686 scale: event.scale(),
687 rotation: event.rotation(),
688 },
689 );
690 }
691 InputEvent::GesturePinchEnd { event } => {
692 let serial = SERIAL_COUNTER.next_serial();
693 let pointer = self.niri.seat.get_pointer().unwrap();
694 pointer.gesture_pinch_end(
695 self,
696 &GesturePinchEndEvent {
697 serial,
698 time: event.time_msec(),
699 cancelled: event.cancelled(),
700 },
701 );
702 }
703 InputEvent::GestureHoldBegin { event } => {
704 let serial = SERIAL_COUNTER.next_serial();
705 let pointer = self.niri.seat.get_pointer().unwrap();
706 pointer.gesture_hold_begin(
707 self,
708 &GestureHoldBeginEvent {
709 serial,
710 time: event.time_msec(),
711 fingers: event.fingers(),
712 },
713 );
714 }
715 InputEvent::GestureHoldEnd { event } => {
716 let serial = SERIAL_COUNTER.next_serial();
717 let pointer = self.niri.seat.get_pointer().unwrap();
718 pointer.gesture_hold_end(
719 self,
720 &GestureHoldEndEvent {
721 serial,
722 time: event.time_msec(),
723 cancelled: event.cancelled(),
724 },
725 );
726 }
727 InputEvent::TouchDown { .. } => (),
728 InputEvent::TouchMotion { .. } => (),
729 InputEvent::TouchUp { .. } => (),
730 InputEvent::TouchCancel { .. } => (),
731 InputEvent::TouchFrame { .. } => (),
732 InputEvent::Special(_) => (),
733 }
734 }
735
736 pub fn process_libinput_event(&mut self, event: &mut InputEvent<LibinputInputBackend>) {
737 if let InputEvent::DeviceAdded { device } = event {
738 // According to Mutter code, this setting is specific to touchpads.
739 let is_touchpad = device.config_tap_finger_count() > 0;
740 if is_touchpad {
741 let c = &self.niri.config.borrow().input.touchpad;
742 let _ = device.config_tap_set_enabled(c.tap);
743 let _ = device.config_scroll_set_natural_scroll_enabled(c.natural_scroll);
744 let _ = device.config_accel_set_speed(c.accel_speed);
745 }
746 }
747 }
748}