Closed airstruck closed 8 years ago
Here's an idea.
Support special mac-
and win-
modifiers. The mac-
modifier is "always on" on Mac, and the (poorly-named) win-
modifier is "always on" everywhere else. So you could write:
{ type = 'button', text = 'Save', shortcut = { 'win-ctrl-s', 'mac-gui-s' } }
But, also support the special c-
modifier mentioned earlier as a shortcut for that, so this would do the same thing:
{ type = 'button', text = 'Save', shortcut = 'c-s' }
The ctrl-
modifier would revert back to meaning just the ctrl keys, not the gui keys.
Support special mac- and win- modifiers. The mac- modifier is "always on" on Mac, and the (poorly-named) win- modifier is "always on" everywhere else
Sounds like a good solution to me :+1:
Done, also supports command-
as an alias for mac-gui-
and option-
as an alias for mac-alt-
.
Still need to fix up the thing that displays shortcuts in menu items.
Brainstorming ideas for making the
shortcut
attribute make more sense across platforms.Consider this example:
This is fine on Windows/Linux, but Mac users will want command-s as the shortcut for saving things. Possible solution (this won't actually work yet; shortcuts don't recognize "gui" as a modifier key yet):
Now Mac users can press command-s, but they can also press ctrl-s, and Windows/Linux users can press win-s. Only the appropriate shortcut for the user's platform should work.
Another idea:
The
command-
modifier would only be relevant on Mac, and would never be triggered elsewhere. Similarly,option-
could be used for the alt key, but only on a Mac. Problem is, ctrl-s still works on Mac, but shouldn't; we'd need something to call the ctrl key that only applies to non-Mac.And another idea:
Here,
c-s
can mean command on Mac and ctrl elsewhere. This only solves a subset of the problem, but it's probably a large subset and it's a reasonably clean solution.Current behavior is
ctrl-
shortcuts really means either ctrl or gui key is pressed, regardless of platform. This should probably change.Related: #25