feat: configurable keybindings for push-to-deafen and quick switcher

- Add deafenKey (default M) and quickSwitcherKey (default P) to settingsAtom
- Settings → Calls: Push to Deafen keybind tile using shared useKeyBind hook
- Settings → Keyboard Shortcuts: new section with Quick Room Switcher keybind
- Extract useKeyBind + keyLabel helpers to reduce duplication in Calls section
- CallControls reads deafenKey from settings (reactive, re-registers on change)
- ClientNonUIFeatures reads quickSwitcherKey from settings (same pattern)
- QuickSwitcher now toggles open/closed on repeat press (Ctrl+key again closes)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-03 00:45:43 -04:00
parent 3cbc5112a7
commit 9d4679d260
4 changed files with 107 additions and 40 deletions
+4 -3
View File
@@ -264,19 +264,20 @@ function MessageNotifications() {
function QuickSwitcherFeature() {
const [open, setOpen] = useState(false);
const [quickSwitcherKey] = useSetting(settingsAtom, 'quickSwitcherKey');
useEffect(() => {
const handleKeyDown = (e: KeyboardEvent) => {
if ((e.ctrlKey || e.metaKey) && e.key === 'p') {
if ((e.ctrlKey || e.metaKey) && e.code === quickSwitcherKey) {
e.preventDefault();
setOpen(true);
setOpen((prev) => !prev);
}
};
window.addEventListener('keydown', handleKeyDown);
return () => {
window.removeEventListener('keydown', handleKeyDown);
};
}, []);
}, [quickSwitcherKey]);
if (!open) return null;
return <QuickSwitcher onClose={() => setOpen(false)} />;