Solve AltGr deadkey problem on macOS #97
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Apple enables AltGr dead-key function arbitrarily for both
Option
keys on macOS, and users cannot disable this behavior. It corrupts all input-related key bindings using Option/Alt/Meta on every macOS software, and every editor & terminal emulator needs to deal with this fucking problem, or you have to remap all your keys fromM-a
toM-å
, etc.There're two popular solutions. One is using Command instead of Option, this will hurt those who love macOS global shortcuts; Another is reading hardware keycode directly to abandon the AltGr conversion, this will only hurt some Europeans. These solutions exist in many software, like emacs-plus & emacs-mac, iTerm2, kitty, etc.
I implemented the latter one in this commit. It makes me able to use any
M
&C-M
-related bindings on macOS. Note that this is only a temporary/partial solution, as the keycode facility in JS web api can possibly disregard the keyboard layout settings, so those who are using Dvorak/Colemak/UK keyboards may need further setups.I hope you can find it useful, but feel free to reject / edit this PR if you don't like the solution.