hotkey icon indicating copy to clipboard operation
hotkey copied to clipboard

Is there a way to specify " " (Space) as a hotkey?

Open laserlemon opened this issue 4 years ago • 2 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! 💛

laserlemon avatar Apr 09 '21 13:04 laserlemon

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".

theinterned avatar Dec 08 '21 22:12 theinterned

This actually relates to https://github.com/github/hotkey/issues/54#issuecomment-992997472 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.

theinterned avatar Dec 16 '21 16:12 theinterned

Updated this issue to also cover Plus (because Mod++ isn't great).

iansan5653 avatar Oct 26 '23 14:10 iansan5653

Typo prevented this from properly closing when it was merged. It was released in 2.3.0

iansan5653 avatar Nov 13 '23 21:11 iansan5653