[gnome-shell-extensions] window-list: Sort buttons by stable sequence
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell-extensions] window-list: Sort buttons by stable sequence
- Date: Wed, 30 Apr 2014 18:22:17 +0000 (UTC)
commit d8eb2273c099f1da40f4df67b0feae464ebc331f
Author: Florian Müllner <fmuellner gnome org>
Date: Tue Apr 8 19:39:38 2014 +0200
window-list: Sort buttons by stable sequence
Currently the initial set of buttons is in stack/MRU order. To
avoid shuffling around the list each time it is disabled/re-enabled
(lock screen) or the group-mode settings changes, sort it by the
stable sequence.
https://bugzilla.gnome.org/show_bug.cgi?id=719933
extensions/window-list/extension.js | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js
index 32f15af..9a1c08d 100644
--- a/extensions/window-list/extension.js
+++ b/extensions/window-list/extension.js
@@ -57,6 +57,12 @@ function _onMenuStateChanged(menu, isOpen) {
actor.sync_hover();
}
+function _getAppStableSequence(app) {
+ return app.get_windows().reduce(function(prev, cur) {
+ return Math.min(prev, cur.get_stable_sequence());
+ }, 0);
+}
+
const WindowContextMenu = new Lang.Class({
Name: 'WindowContextMenu',
@@ -892,11 +898,19 @@ const WindowList = new Lang.Class({
this._windowList.destroy_all_children();
if (!this._grouped) {
- let windows = Meta.get_window_actors(global.screen);
+ let windows = Meta.get_window_actors(global.screen).sort(
+ function(w1, w2) {
+ return w1.metaWindow.get_stable_sequence() -
+ w2.metaWindow.get_stable_sequence();
+ });
for (let i = 0; i < windows.length; i++)
this._onWindowAdded(null, windows[i].metaWindow);
} else {
- let apps = this._appSystem.get_running();
+ let apps = this._appSystem.get_running().sort(
+ function(a1, a2) {
+ return _getAppStableSequence(a1) -
+ _getAppStableSequence(a2);
+ });
for (let i = 0; i < apps.length; i++)
this._addApp(apps[i]);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]