mirror of
https://github.com/ByteAtATime/raycast-linux.git
synced 2025-08-31 03:07:23 +00:00
feat(actions): sort keyboard shortcut modifiers
This commit is contained in:
parent
51805dbe7e
commit
518da848fe
1 changed files with 4 additions and 1 deletions
|
@ -21,6 +21,8 @@
|
|||
|
||||
const modifierMap = platform() === 'macos' ? macModifierMap : standardModifierMap;
|
||||
|
||||
const modifierOrder: KeyboardShortcut['modifiers'] = ['ctrl', 'opt', 'shift', 'cmd'];
|
||||
|
||||
const keyMap: Partial<Record<KeyboardShortcut['key'], string>> = {
|
||||
return: '⏎',
|
||||
enter: '⏎',
|
||||
|
@ -36,7 +38,8 @@
|
|||
space: '␣'
|
||||
};
|
||||
|
||||
const symbols = shortcut.modifiers
|
||||
const symbols = [...shortcut.modifiers]
|
||||
.sort((a, b) => modifierOrder.indexOf(a) - modifierOrder.indexOf(b))
|
||||
.map((modifier) => modifierMap[modifier])
|
||||
.concat(keyMap[shortcut.key] ?? shortcut.key.charAt(0).toUpperCase() + shortcut.key.slice(1));
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue