From b20d8e7062ce1cbbffdfa64a7b32d2393237ea26 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Fri, 13 Oct 2023 13:30:11 +0400 Subject: Implement ext-session-lock --- src/input.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/input.rs') diff --git a/src/input.rs b/src/input.rs index 24504f7d..157edb59 100644 --- a/src/input.rs +++ b/src/input.rs @@ -136,7 +136,7 @@ impl State { let serial = SERIAL_COUNTER.next_serial(); let time = Event::time_msec(&event); - let action = self.niri.seat.get_keyboard().unwrap().input( + let mut action = self.niri.seat.get_keyboard().unwrap().input( self, event.key_code(), event.state(), @@ -152,6 +152,19 @@ impl State { }, ); + // Filter actions when the session is locked. + if self.niri.is_locked() { + match action { + Some( + Action::Quit + | Action::ChangeVt(_) + | Action::Suspend + | Action::PowerOffMonitors, + ) => (), + _ => action = None, + } + } + if let Some(action) = action { match action { Action::None => unreachable!(), -- cgit