mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-03 00:33:49 +03:00
feat: add keyboard shortcut to focus header search bar
This commit is contained in:
parent
2a6346cb69
commit
3adc8662dc
@ -65,6 +65,19 @@ export function Header({ onSearch, onClear, search }: HeaderProps) {
|
||||
navigate(-1);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
window.onkeydown = (event: KeyboardEvent) => {
|
||||
const { key, ctrlKey } = event;
|
||||
if (!isFocused && ctrlKey && key === "k") {
|
||||
focusInput();
|
||||
}
|
||||
};
|
||||
|
||||
return () => {
|
||||
window.onkeydown = null;
|
||||
};
|
||||
}, [isFocused]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<header
|
||||
|
Loading…
Reference in New Issue
Block a user