notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit d5dfb0df435fb3030e39e0731ccf8823e0af30d4
parent bda0b4c56c6c0080b1829e86dc393c6556dffe49
Author: William Casarin <jb55@jb55.com>
Date:   Tue, 27 Jan 2026 08:13:44 -0800

dave: fix Ctrl+number bindings taking precedence over permission keys

Ctrl+1/2/3 for agent switching was being intercepted by the bare
1/2 accept/deny permission bindings. Fix by:
1. Moving Ctrl+number check before permission bindings
2. Only triggering permission bindings when no modifiers are held

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Diffstat:
Mcrates/notedeck_dave/src/ui/keybindings.rs | 41+++++++++++++++++++++++++++--------------
1 file changed, 27 insertions(+), 14 deletions(-)

diff --git a/crates/notedeck_dave/src/ui/keybindings.rs b/crates/notedeck_dave/src/ui/keybindings.rs @@ -17,6 +17,8 @@ pub enum KeyAction { NewAgent, /// Interrupt/stop the current AI operation Interrupt, + /// Toggle between scene view and classic view + ToggleView, } /// Check for keybinding actions. @@ -50,23 +52,13 @@ pub fn check_keybindings(ctx: &egui::Context, has_pending_permission: bool) -> O return Some(KeyAction::NewAgent); } - // When there's a pending permission, 1 = accept, 2 = deny (no Ctrl needed) - // Input is unfocused when permission is pending, so bare keys work - if has_pending_permission { - if let Some(action) = ctx.input(|i| { - if i.key_pressed(Key::Num1) { - Some(KeyAction::AcceptPermission) - } else if i.key_pressed(Key::Num2) { - Some(KeyAction::DenyPermission) - } else { - None - } - }) { - return Some(action); - } + // Ctrl+G to toggle between scene view and classic view + if ctx.input(|i| i.modifiers.matches_exact(ctrl) && i.key_pressed(Key::G)) { + return Some(KeyAction::ToggleView); } // Ctrl+1-9 for switching agents (works even with text input focus) + // Check this BEFORE permission bindings so Ctrl+number always switches agents if let Some(action) = ctx.input(|i| { if !i.modifiers.matches_exact(ctrl) { return None; @@ -96,5 +88,26 @@ pub fn check_keybindings(ctx: &egui::Context, has_pending_permission: bool) -> O return Some(action); } + // When there's a pending permission, 1 = accept, 2 = deny (no Ctrl needed) + // Input is unfocused when permission is pending, so bare keys work + // This is checked AFTER Ctrl+number so Ctrl bindings take precedence + if has_pending_permission { + if let Some(action) = ctx.input(|i| { + // Only trigger on bare keypresses (no modifiers) + if i.modifiers.any() { + return None; + } + if i.key_pressed(Key::Num1) { + Some(KeyAction::AcceptPermission) + } else if i.key_pressed(Key::Num2) { + Some(KeyAction::DenyPermission) + } else { + None + } + }) { + return Some(action); + } + } + None }