-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modifiers ergonomics improvements #7
Comments
I am happy if my crate can help a bit with this!
Yes, we can add this impl block. I'd suggest to add only the most common modifiers like in JS KeyboardEvent:
The other modifiers are rarely used in keyboard shortcuts and would IMHO clutter the documentation. By the way, would it make sense to add these convenient getters to the
Right now strings are checked before they are converted to Did you see the
Sure, please create issues for anything that comes up. |
Thanks for the thoughtful and timely response. The impl block for the four basic modifiers sounds great, that's what we have in our draft PR. I understand your concerns about an We did see |
I suggest to create a trait for matching keys, chars and strings in hotkeys similar to
Servo has the
I agree, with the custom event you can modify the type so it works best for druid. |
Detect whether the user is on an Apple platform with the right checks on This is what Fastmail does in its Overture library, used primarily for its webmail. Relevant code: resolution of “Cmd-” to “Ctrl-” or “Meta-” depending on platform; determination of whether the user is on an Apple platform. Also potentially relevant is formatting of keyboard shortcuts; for when you take into account platform conventions, you could get a display label of |
This partially addresses pyfisch#7.
This partially addresses pyfisch#7.
This partially addresses pyfisch#7.
This partially addresses pyfisch#7.
First, a heads-up, we're in the process of adopting this crate as our standard keyboard event type in druid, see linebender/druid#1049 in particular. We appreciate having the crate are hopeful that it's a small step towards convergence in low-level platform integration the ecosystem.
There are a number of things we've run into as part of the integration. One ergonomics regression is that
.shift
(the old KeyModifiers was a struct of pub bools) has become.contains(Modifiers::SHIFT)
. Would you be open to an additional impl block withshift()
and friends?As a much lower priority, we also have an
IntoKey
trait that will convert any string intoKey::Character(...)
, and this is used primarily to construct hotkeys. This has different semantics than yourFromStr
because it's not designed to parse strings like "Enter". It would be slightly more convenient for us to upgrade this to anInto
, but I completely understand if you wouldn't want that.There may be other work that makes sense to upstream, and if you're interested I can create additional issues.
The text was updated successfully, but these errors were encountered: