From 1b929fe9af2dffdb8c4f96833e5c8dfd295bf25d Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Tue, 21 Jul 2026 20:36:12 +0800 Subject: [PATCH] laptop16: Detect powerbutton short-press immediately This works because there was a release. We immediately trigger on button release. Long-press to shut off still works because that triggers based on timeout without the need to release. Signed-off-by: Daniel Schaefer --- src/state_machine.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/state_machine.rs b/src/state_machine.rs index 03268ee..b1c3911 100644 --- a/src/state_machine.rs +++ b/src/state_machine.rs @@ -1162,7 +1162,7 @@ pub fn start( // Detect short press of power button // Short press (or ESC) will exit and boot (skip all further checks) - let short_press = (!button_pressed && state.prev_pressed && long_press == 1) + let short_press = (!button_pressed && state.prev_pressed) || state.keypress == Some(Key::Special(ScanCode::ESCAPE)); match (short_press, state.frame.clone()) { // Reboot