After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 719933 - window list reshuffles itself every time the screen locks
window list reshuffles itself every time the screen locks
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: extensions
3.9.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2013-12-05 19:32 UTC by Dan Winship
Modified: 2014-04-30 18:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
window-list: Sort buttons by stable sequence (2.04 KB, patch)
2014-04-15 15:52 UTC, Florian Müllner
none Details | Review
window-list: Sort buttons by stable sequence (2.11 KB, patch)
2014-04-15 16:27 UTC, Florian Müllner
committed Details | Review

Description Dan Winship 2013-12-05 19:32:31 UTC
I've had this vague feeling that it's harder to find things in the gnome-shell window list than it was in the GNOME 2 window list, and finally figured out that it's because the buttons get rearranged into MRU order every time you lock and unlock the screen. (Probably the window list is being destroyed and recreated?) So instead of knowing that my terminal windows and emacs and thunderbird are way on the left, and that browser window I opened 15 minutes ago is somewhere on the right, any of them could end up anywhere.
Comment 1 Rui Matos 2013-12-06 11:28:50 UTC
Without looking at the code I think this is because the window list is implemented as an extension and extensions are disabled on the lock screen and then re-enabled.
Comment 2 Rui Matos 2013-12-06 11:29:56 UTC
Perhaps we should just whitelist the classic mode extensions?
Comment 3 Dan Winship 2013-12-06 13:32:54 UTC
I think if it just created the list in window-creation-time order rather than last-used-timestamp order then that would work as well. Though I'm not sure anything currently keeps track of that.

Another possibility would be to just allow each extension to provide a bit of data to be saved when the screensaver goes on, which would be passed back to it when it's re-enabled. (Though then it would have to check if windows had been added or removed while it was disabled, so maybe that would be more complicated than it sounds.)
Comment 4 Florian Müllner 2013-12-06 17:13:11 UTC
 (In reply to comment #3)
> I think if it just created the list in window-creation-time order rather than
> last-used-timestamp order then that would work as well. Though I'm not sure
> anything currently keeps track of that.

Startup-notifications should contain a timestamp, either as part of the ID or as a separate property. We'd obviously miss windows that are launched without startup id, but maybe that's not that much of an issue in practice?


> Another possibility would be to just allow each extension to provide a bit of
> data to be saved when the screensaver goes on, which would be passed back to it
> when it's re-enabled.

Well, enabling/disabling of extensions is implemented by calling corresponding extension methods, so extensions can certainly do that already.


> (Though then it would have to check if windows had been
> added or removed while it was disabled, so maybe that would be more complicated
> than it sounds.)

It's unlikely that this is the case while the screen is locked, but the extension may be disabled manually by the user and re-enabled after a month or so, so that'd definitively be needed.
Comment 5 Rui Matos 2013-12-06 18:22:30 UTC
I think whitelisting is a better option here, at least for the window list. For instance, I've noticed that maximized windows are resized when going into and out of the lock screen which is likely to be because this extension is changing struts as it gets enabled/disabled.
Comment 6 Florian Müllner 2013-12-06 19:22:59 UTC
(In reply to comment #5)
> I think whitelisting is a better option here, at least for the window list.

Not sure - I've been pointed to a downstream bug[0], which is quite similar though unrelated to the lock screen.
(Of course the best option could still be to address both issues separately)

[0] https://bugzilla.redhat.com/show_bug.cgi?id=1025370
Comment 7 Jasper St. Pierre (not reading bugmail) 2013-12-07 16:57:48 UTC
So, my personal opinion is that disabling and re-enabling the extension, however done, should try to change as minimally as possible.

Making the window list sort all existing windows by get_stable_sequence() on startup should work for this, if I understand it correctly.

I'm fine with adding a flag to "enable on lock screen" in meta.json, but I want to be very careful about this. Naive extensions like the places-menu should not be exposed on the lock screen, and that's why I disabled them.
Comment 8 Florian Müllner 2014-04-15 15:52:36 UTC
Created attachment 274378 [details] [review]
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.
Comment 9 Jasper St. Pierre (not reading bugmail) 2014-04-15 15:58:13 UTC
Review of attachment 274378 [details] [review]:

::: extensions/window-list/extension.js
@@ +905,3 @@
+                    w1 = a1.get_windows().reduce(function(prev, cur) {
+                        return Math.min(prev, cur.get_stable_sequence());
+                    }, 0);

fyi Math.min can take more than two arguments. So this could be Math.min.apply(null, a1.get_windows().map(function(w) { return w.get_stable_sequence(); }));

which I suppose isn't much better... perhaps split this out as getStableSequenceForApp(); somewhere above?
Comment 10 Florian Müllner 2014-04-15 16:27:52 UTC
Created attachment 274380 [details] [review]
window-list: Sort buttons by stable sequence
Comment 11 Florian Müllner 2014-04-30 18:22:39 UTC
Attachment 274380 [details] pushed as d8eb227 - window-list: Sort buttons by stable sequence