mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-10-31 00:12:39 +00:00
13 lines
613 B
TypeScript
13 lines
613 B
TypeScript
import { isSingleCharacterKey } from "@/lib/keyboard";
|
|
import { useSettingsStore } from "@/stores/settings-store";
|
|
|
|
/**
|
|
* True when the user turned single-key shortcuts off (Settings >
|
|
* Accessibility) and this key press is one: a printable character without
|
|
* Ctrl, Alt or ⌘. Read at the time of the key press, so a window listener
|
|
* needs no re-subscribe when the setting changes.
|
|
*/
|
|
export function isSingleKeyShortcutOff(event: Pick<KeyboardEvent, "key" | "ctrlKey" | "metaKey" | "altKey">): boolean {
|
|
return isSingleCharacterKey(event) && useSettingsStore.getState().singleKeyShortcuts === false;
|
|
}
|