mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-03 08:43:48 +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);
|
navigate(-1);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
window.onkeydown = (event: KeyboardEvent) => {
|
||||||
|
const { key, ctrlKey } = event;
|
||||||
|
if (!isFocused && ctrlKey && key === "k") {
|
||||||
|
focusInput();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
window.onkeydown = null;
|
||||||
|
};
|
||||||
|
}, [isFocused]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<header
|
<header
|
||||||
|
Loading…
Reference in New Issue
Block a user