[gnome-shell/wip/carlosg/input-sources-order] status: Used fixed sorting of input sources on empty MRU




commit beeba0b33aa335da794a97bf029c9baeecf94baf
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Sep 14 20:20:14 2022 +0200

    status: Used fixed sorting of input sources on empty MRU
    
    When updating the MRU sources if there was no prior MRU, we want
    to go with the unmodified list of sources in visibility order.
    
    However, the InputSourceManager._inputSources object holding the
    available input sources is a set, that makes iterating across it
    happen in an undetermined order, which makes the initial MRU list
    pick a value at random.
    
    In order to prefer the sources list in the same order than they
    appear in the menu if there was no prior MRU, order the keys
    when accessing it and building the initial list of sources.
    
    Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5873

 js/ui/status/keyboard.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js
index 76a42f6bd7..229e85b671 100644
--- a/js/ui/status/keyboard.js
+++ b/js/ui/status/keyboard.js
@@ -492,7 +492,7 @@ var InputSourceManager = class extends Signals.EventEmitter {
 
     _updateMruSources() {
         let sourcesList = [];
-        for (let i in this._inputSources)
+        for (let i of Object.keys(this._inputSources).sort())
             sourcesList.push(this._inputSources[i]);
 
         this._keyboardManager.setUserLayouts(sourcesList.map(x => x.xkbId));


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