diff --git a/terminus-core/src/services/hotkeys.service.ts b/terminus-core/src/services/hotkeys.service.ts index e4a668e3..f1745616 100644 --- a/terminus-core/src/services/hotkeys.service.ts +++ b/terminus-core/src/services/hotkeys.service.ts @@ -104,7 +104,11 @@ export class HotkeysService { item = (typeof item === 'string') ? [item] : item try { - this.electron.globalShortcut.register(item[0].replace(/-/g, '+'), () => { + let electronKeySpec = item[0] + electronKeySpec = electronKeySpec.replace('⌘', 'Command') + electronKeySpec = electronKeySpec.replace('⌥', 'Alt') + electronKeySpec = electronKeySpec.replace(/-/g, '+') + this.electron.globalShortcut.register(electronKeySpec, () => { this.globalHotkey.emit() }) } catch (err) { @@ -131,7 +135,7 @@ export class HotkeysService { value = [value] } if (value) { - value = value.map((item) => (typeof item === 'string') ? [item] : item) + value = value.map(item => (typeof item === 'string') ? [item] : item) keys[key] = value } } diff --git a/terminus-core/src/services/hotkeys.util.ts b/terminus-core/src/services/hotkeys.util.ts index b2769b65..92fb3743 100644 --- a/terminus-core/src/services/hotkeys.util.ts +++ b/terminus-core/src/services/hotkeys.util.ts @@ -45,13 +45,12 @@ export function stringifyKeySequence (events: NativeKeyEvent[]): string[] { // TODO make this optional? continue } - if (event.key === ' ') { - itemKeys.push('Space') - } else if (event.key.length === 1) { - itemKeys.push(event.key.toUpperCase()) - } else { - itemKeys.push(event.key) - } + + let key = (event as any).code + key = key.replace('Key', '') + key = key.replace('Arrow', '') + key = key.replace('Digit', '') + itemKeys.push(key) items.push(itemKeys.join('-')) } }