diff options
Diffstat (limited to 'src/input.rs')
| -rw-r--r-- | src/input.rs | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/input.rs b/src/input.rs index 387969f3..30d8e100 100644 --- a/src/input.rs +++ b/src/input.rs @@ -49,9 +49,24 @@ impl State { // here. self.niri.layout.advance_animations(get_monotonic_time()); - // Power on monitors if they were off. - if should_activate_monitors(&event) { - self.niri.activate_monitors(&mut self.backend); + if self.niri.monitors_active { + // Notify the idle-notifier of activity. + if should_notify_activity(&event) { + self.niri + .idle_notifier_state + .notify_activity(&self.niri.seat); + } + } else { + // Power on monitors if they were off. + if should_activate_monitors(&event) { + self.niri.activate_monitors(&mut self.backend); + + // Notify the idle-notifier of activity only if we're also powering on the + // monitors. + self.niri + .idle_notifier_state + .notify_activity(&self.niri.seat); + } } let hide_hotkey_overlay = @@ -1497,6 +1512,13 @@ fn should_hide_exit_confirm_dialog<I: InputBackend>(event: &InputEvent<I>) -> bo } } +fn should_notify_activity<I: InputBackend>(event: &InputEvent<I>) -> bool { + match event { + InputEvent::DeviceAdded { .. } | InputEvent::DeviceRemoved { .. } => false, + _ => true, + } +} + fn allowed_when_locked(action: &Action) -> bool { matches!( action, |
