Skip to content

Commit

Permalink
Forward keys to trigger quickbar (#587)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus authored May 14, 2022
1 parent 18e81bd commit a1cd91c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,19 @@ class HacsFrontend extends HacsElement {
})
);

document.body.addEventListener("keydown", (ev: KeyboardEvent) => {
if (ev.key || ev.ctrlKey || ev.shiftKey || ev.metaKey) {
// Ignore if modifier keys are pressed
return;
}
if (["c", "m", "e"].includes(ev.key)) {
// @ts-ignore
fireEvent(mainWindow, "hass-quick-bar-trigger", ev, {
bubbles: false,
});
}
});

makeDialogManager(this, this.shadowRoot!);
}

Expand Down

0 comments on commit a1cd91c

Please sign in to comment.