[gnome-shell/gnome-3-34] keyboard: Try harder to find a matching layout



commit 64b62de5df7358fa55921ac0b3c5409c030c58e3
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Nov 16 12:48:35 2019 +0000

    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
    
    
    (cherry picked from commit c1ec7b2ffa5b4e5f8b6a31d9cb3eaed0712bd03a)

 js/ui/keyboard.js | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index 45eb5ce82e..3d8e84f567 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -466,10 +466,17 @@ Signals.addSignalMethods(Key.prototype);
 
 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) {
+            }
         }
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]