keyboard: Try harder to find a matching layout

While we support a reasonable list of layouts nowadays, we don't
include many variants like `fr+oss`. Instead of directly falling
back to the `us` layout, try stripping the variant first, as the
base layout is likely closer to the expectation than `us`.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1907
This commit is contained in:
Florian Müllner 2019-11-16 13:48:35 +01:00
parent 45ebb94b33
commit c1ec7b2ffa

View File

@ -478,10 +478,17 @@ var Key = GObject.registerClass({
var KeyboardModel = class {
constructor(groupName) {
try {
this._model = this._loadModel(groupName);
} catch (e) {
this._model = this._loadModel('us');
let names = [groupName];
if (names.includes('+'))
names.push(groupName.replace(/\+.*/, ''));
names.push('us');
for (let i = 0; i < names.length; i++) {
try {
this._model = this._loadModel(names[i]);
break;
} catch (e) {
}
}
}