Implemented option_as_alt to allow for ignoring option key characters#2576
Conversation
|
I reverted back to the version that is roughly the same port as @kjmph's branch. I then disabled IME and everything works correctly. This makes sense as all the IME handling was added after the original fix was created. Now to figure out why... My test case is:
|
|
This call |
|
This version works and does not break IME (as far I can tell). |
chrisduerr
left a comment
There was a problem hiding this comment.
Are you still working on this patch? If it's done you should probably ping one of the macOS maintainers, I don't think it's on their radar.
|
@madsmtm, this is complete minus updating the feature matrix and documentation. I am not sure this is relevant for the feature matrix, and I was unsure if anymore was needed for documentation beyond the documentation on the trait. thoughts? |
Any update on this PR? Have been waiting for this feature for a long time as an Alacritty user. |
I think we are just waiting for feedback from @madsmtm |
There was a problem hiding this comment.
What I was mostly worried about was how this interacts with IME, and as far as I can tell it seems like it doesn't negatively impact that at all, so that's nice!
I looked through the implementation now, looks good, only a few concerns.
Thanks for your patience!
|
I'll add one more note, that such behavior is desired for only e.g. one of the |
|
So something like: enum OptionAsAlt {
All,
OnlyRight,
OnlyLeft,
None,
}Though I suspect it will be a bit tricky to implement, since macOS doesn't easily expose which OPTION button is being held down. (So I'd be fine with deferring that). |
I think you have that via the raw key event? At least in the past we were able to determine left/right alt? |
|
Yeah, it's definitely possible to know when the left or the right ALT button has been pressed, but (at least as far as I know) macOS doesn't track that information for us (like it otherwise does), hence why it might be a bit tricky. Perhaps we can leave the user to implement it themselves on top of let mut set_option_as_lalt = true;
match event {
WindowEvent::KeyboardInput {
input: KeyboardInput {
virtual_keycode: Some(VirtualKeyCode::LAlt),
state,
..
},
..
} => {
if set_option_as_lalt {
window.set_option_as_alt(state == ElementState::Pressed);
}
}
_ => {}
}(Assuming it works? Would be nice to have the example updated with it if so.) |
|
@ayax79 - would be great to get this merged in. Sorry, I can't help much =) |
|
Sorry... I just started a new job and I have been pretty slammed. Hoping to get back to this soon. |
18f645d to
5d9d3ca
Compare
|
I've taken the liberty to update this branch and add the requested functionality. I've tested on my macOS machine with the example in the repo, and the events are correct for all left/right/both/none variations. @madsmtm could you take a look? |
c800089 to
7bb64d4
Compare
madsmtm
left a comment
There was a problem hiding this comment.
Implementation looks fine, only a few nits wrt. documentation and such
This adds an ability to control left and right `Option` keys to be treated as `Alt`, thus not producing diacritical marks.
7bb64d4 to
e5da6c6
Compare
|
Thanks, @ayax79 |
|
Perfect, thanks! |
|
Yeah this has been a long standing issue on macOS that wasn't particularly difficult but simply didn't get resolved because there was no macOS developer interested in stepping up and fixing it. So thanks for stepping up. |
|
Thanks everyone! I can't wait to try this out! |
|
Woot woot! this is awesome! Thanks team! |
|
Just pulled and built the latest - am unsure how to actually enable this from the config though? Awesome! read the code and found I I needed this in my config: |
|
Yes, the |
Based off the Fix Alt Modifier on Mac OS PR.
I have tested by rebuilding alacritty here and testing to ensure that alt bindings in zellij work correctly. I have also tested that IME works.
CHANGELOG.mdif knowledge of this change could be valuable to users