mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: add keyboard shortcut to focus header search bar
This commit is contained in:
parent
2a6346cb69
commit
3adc8662dc
1 changed files with 13 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue