feat: add global hotkey (#2401)

This commit is contained in:
Oliver
2025-04-30 13:49:59 -05:00
committed by GitHub
parent fc54cbbaaf
commit cb6fca2e1d
2 changed files with 73 additions and 3 deletions

View File

@@ -551,6 +551,20 @@ export default function App() {
};
}, []);
// Focus the first found input field
useEffect(() => {
const handleFocusInput = (_event: IpcRendererEvent) => {
const inputField = document.querySelector('input[type="text"], textarea') as HTMLInputElement;
if (inputField) {
inputField.focus();
}
};
window.electron.on('focus-input', handleFocusInput);
return () => {
window.electron.off('focus-input', handleFocusInput);
};
}, []);
// TODO: modify
const handleConfirm = async () => {
if (pendingLink) {