Make the voice mute shortcut configurable in the TUI (#43690)

## Why

Voice mute used a hard-coded `Ctrl+X` shortcut and footer hint, so keymap customization could not change or disable it.

## What changed

- Wire `tui.keymap.chat.toggle_voice_mute` into runtime keybindings and the keymap picker, supporting custom keys, chords, and unbinding.
- Keep `Ctrl+X` as the default, but let existing configured shortcuts and overlapping chord prefixes take precedence. Validate explicitly configured mute bindings for conflicts.
- Activate voice chords only when the microphone shortcut is available, excluding pagers and overlays.
- Refresh the voice footer when bindings change, showing the configured shortcut or `/voice mute` when unbound.

## Testing

Add regression tests for binding resolution, conflicts, voice chord context, and live keymap updates. Add footer snapshots covering custom keys, chords, and unbinding in muted and listening states at wide and narrow widths.

GitOrigin-RevId: ec9385f3956aa268bba34dcf2cc2b0c92a31bfec
This commit is contained in:
Benjamin Carlsson authored and copyberry committed 2026-09-08 04:03:42 +00:00
1 parent 98c7c0415b
commit 45305dd229
20 files changed
+319 -45

No files matched your search

+14 -6
View File
@@ -121,15 +121,23 @@ impl App {
}
fn active_keymap_contexts(&self) -> crate::keymap::KeymapContextSet {
if self.overlay.is_some() {
return crate::keymap::KeymapContextSet::new(crate::keymap::KeymapContext::Pager);
}
use crate::keymap::KeymapContext;
use crate::keymap::KeymapContextSet;
if self.overlay.is_some() {
return KeymapContextSet::new(KeymapContext::Pager);
}
let voice_available = self.chat_widget.realtime_microphone_shortcut_available();
let contexts = self.chat_widget.keymap_contexts();
if self.chat_widget.no_modal_or_popup_active() {
contexts
.with(crate::keymap::KeymapContext::Global)
.with(crate::keymap::KeymapContext::Chat)
let contexts = contexts
.with(KeymapContext::Global)
.with(KeymapContext::Chat);
if voice_available {
contexts.with(KeymapContext::Voice)
} else {
contexts
}
} else {
contexts
}