keyboard: Fix display keyboard layout crash with some input methods
Some ibus input method will use the current keyboard layout, and return "default" as the keyboard layout. When this happens, display the current keyboard layout instead. Fixes #3863. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1756>
This commit is contained in:
parent
51a7c9a8b8
commit
f563424417
@ -156,4 +156,8 @@ var KeyboardManager = class {
|
||||
let options = this._xkbOptions.join(',');
|
||||
return options;
|
||||
}
|
||||
|
||||
get currentLayout() {
|
||||
return this._current;
|
||||
}
|
||||
};
|
||||
|
@ -772,6 +772,10 @@ var InputSourceManager = class {
|
||||
get inputSources() {
|
||||
return this._inputSources;
|
||||
}
|
||||
|
||||
get keyboardManager() {
|
||||
return this._keyboardManager;
|
||||
}
|
||||
};
|
||||
Signals.addSignalMethods(InputSourceManager.prototype);
|
||||
|
||||
@ -1059,6 +1063,14 @@ class InputSourceIndicator extends PanelMenu.Button {
|
||||
xkbLayout = engineDesc.get_layout();
|
||||
xkbVariant = engineDesc.get_layout_variant();
|
||||
}
|
||||
|
||||
// The `default` layout from ibus engine means to
|
||||
// use the current keyboard layout.
|
||||
if (xkbLayout === 'default') {
|
||||
const current = this._inputSourceManager.keyboardManager.currentLayout;
|
||||
xkbLayout = current.layout;
|
||||
xkbVariant = current.variant;
|
||||
}
|
||||
}
|
||||
|
||||
if (!xkbLayout || xkbLayout.length == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user