commit 7335b14a70deaaf616d3adf1bee71a9ea9407fc7
parent 8bfe580539f73b6fd15d7daeef61bd71d9937f80
Author: William Casarin <jb55@jb55.com>
Date: Tue, 27 Jan 2026 07:07:18 -0800
dave: use bare 1/2 keys for permission responses
Since text input is unfocused when a permission dialog is pending,
we can use 1 and 2 directly without the Ctrl modifier for accepting
and denying permissions. This is more ergonomic than Ctrl+1/Ctrl+2.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat:
1 file changed, 18 insertions(+), 11 deletions(-)
diff --git a/crates/notedeck_dave/src/ui/keybindings.rs b/crates/notedeck_dave/src/ui/keybindings.rs
@@ -20,7 +20,8 @@ pub enum KeyAction {
}
/// Check for keybinding actions.
-/// All keybindings use Ctrl modifier to avoid conflicts with text input.
+/// Most keybindings use Ctrl modifier to avoid conflicts with text input.
+/// Exception: 1/2 for permission responses work without Ctrl since input is unfocused.
pub fn check_keybindings(ctx: &egui::Context, has_pending_permission: bool) -> Option<KeyAction> {
// Escape works even when text input has focus (to interrupt AI)
if ctx.input(|i| i.key_pressed(Key::Escape)) {
@@ -49,22 +50,28 @@ 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+1-9 for switching agents (works even with text input focus)
- // When there's a pending permission, Ctrl+1 = accept, Ctrl+2 = deny
if let Some(action) = ctx.input(|i| {
if !i.modifiers.matches_exact(ctrl) {
return None;
}
- if has_pending_permission {
- if i.key_pressed(Key::Num1) {
- return Some(KeyAction::AcceptPermission);
- }
- if i.key_pressed(Key::Num2) {
- return Some(KeyAction::DenyPermission);
- }
- }
-
for (idx, key) in [
Key::Num1,
Key::Num2,