From bbe67130fede80887bee59ec6f76e2544eccef7a Mon Sep 17 00:00:00 2001 From: haffel Date: Sat, 12 Sep 2026 12:18:35 +0200 Subject: [PATCH] Add keyboard escape to hide popup --- .agents/CLIPBHOARD_HARDENING_CHECKLIST.md | 3 +++ src/gui.rs | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/.agents/CLIPBHOARD_HARDENING_CHECKLIST.md b/.agents/CLIPBHOARD_HARDENING_CHECKLIST.md index 3aeef53..92e8a51 100644 --- a/.agents/CLIPBHOARD_HARDENING_CHECKLIST.md +++ b/.agents/CLIPBHOARD_HARDENING_CHECKLIST.md @@ -47,6 +47,9 @@ Each bounded iteration must: - [x] Preserve search query and surviving selection after refresh-triggering actions (17 core tests and Docker GTK/X11 build, 2026-09-10). - [ ] Keep keyboard pause state synchronized with button and status text. - [ ] Implement complete keyboard-first navigation and commands. +- [x] Make Escape hide the popup from the keyboard controller (24 X11-feature + tests and Docker GTK/X11/package build, 2026-09-12); live GUI acceptance is + still pending. - [ ] Ensure copy, paste, pin, delete, clear, pause, and resume have consistent UI feedback. - [x] Surface actionable status text for keyboard and toolbar action failures, including successful clipboard writes with failed history updates (Docker GTK/X11 build, 2026-09-10). - [x] Replace the conflict-prone `Ctrl+R` pause shortcut with `Ctrl+Alt+R`, and expose the configured global shortcut in the window title/status (Docker GTK/X11 build; live tray/capture verified, 2026-09-10). diff --git a/src/gui.rs b/src/gui.rs index 68bfecb..cd54d32 100644 --- a/src/gui.rs +++ b/src/gui.rs @@ -200,6 +200,10 @@ fn build_window( let keys = gtk4::EventControllerKey::new(); keys.set_propagation_phase(gtk4::PropagationPhase::Capture); keys.connect_key_pressed(move |_, key, _, modifiers| { + if key == gtk4::gdk::Key::Escape { + window_for_keys.set_visible(false); + return glib::Propagation::Stop; + } if (key == gtk4::gdk::Key::Up || key == gtk4::gdk::Key::Down) && list_for_keys.selected_row().is_none() {