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:
@@ -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)} />;
|
||||
|
||||
Reference in New Issue
Block a user