Add support for `Space` and `Plus` keywords
Closed this issue ยท 4 comments
It seems that the eventToHotkeyString
function returns " "
for a spacebar keystroke, as described in the key values docs. But the expandHotkeyToEdges
function also uses the space character to split hotkey combinations.
So how might one define a single hotkey or hotkey combination containing a space?
We might consider a slight deviation from the key values docs in this instance to add the Space shorthand as an alias for " "
when defining a hotkey via the data-hotkey
attribute or install
function. Thank you! ๐
Maybe we could use "Space"
as a way to distinguish space as a separator of key sequences (" "
), and the literal space key as a shortcut ("Space"
).
So for example the shortcut key to open Spotlight / Alfred / Raycast on a Mac would be "Meta+Space"
.
This actually relates to #54 (comment) where I suggest we match on event.code
rather than event.key
. The event.key
for space is " "
: the event.code
is "Space"
, so making that breaking change would also resolve this issue.
If we don't make that change, then this would require some special code.
Updated this issue to also cover Plus
(because Mod++
isn't great).
Typo prevented this from properly closing when it was merged. It was released in 2.3.0