-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Implemented dynamic keyboard layout detection #5063
Conversation
@AlexTugarev I had to change the fix for #4986. Please verify it still works with your keyboard. |
The next step should be to store the detected layout so the user doesn't start with the default every time she reloads the page. Where should this be stored? LocalStorageService? |
import { injectable, postConstruct } from 'inversify'; | ||
import { isOSX, isWindows } from '../../common/os'; | ||
import { injectable, postConstruct, inject } from 'inversify'; | ||
import { IKeyboardLayoutInfo } from 'native-keymap'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's just type right? it's erased from generated js? native-keymap
dependency is not installed for the browser target
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's just an interface. I reference that from several files. Should we move the type definition to core/src/common
to avoid the warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm fine with any way. Keeping in one place could be better that noone tries to import in other places. Maybe adding a comment would help.
@AlexTugarev what is your setup? A built-in ISO keyboard (with |
Strange requirements you have :-D I'll propose a different fix. |
Signed-off-by: Miro Spönemann <miro.spoenemann@typefox.io>
@AlexTugarev done. Please verify again. I also changed the naming scheme of the static json files with keyboard layouts: instead of |
@spoenemann, this works like a charm! |
isn't it great to have it tested with a proper setup? :-D |
@spoenemann Thank you so very very much! :-D |
@AlexTugarev can you finish the review and merge it if it is ready? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That works really smooth!
Tested with US, German, ISO, ansi settings.
Fixes #5042.
Layout changes are now logged as INFO. When I open Theia with Firefox on my machine it says:
because I have set English as OS language. As soon as I press the
Ö
key on my keyboard:I switch the system keyboard layout to French and press the same key again:
The layout change is even intercepted before a keybinding is executed. For example, pressing
ctrl+shift+´
after loading the page, the keyboard layout is immediately switched to German and the translated keybinding for New Terminal (ctrl+`
) is executed.