Dash-to-dock: [request] Do not reorder window thumbnails after clicking on them

Created on 9 Nov 2017  路  27Comments  路  Source: micheleg/dash-to-dock

I have Dash to dock configured to display previews of opened windows after clicking on the icon of an app with multiple windows open. That works nicely, after clicking on the second window it switches to that window. Problem is, the next time I click on the app icon, the currently focused window is first in the list.

Can it be made so that it would sort windows in the order of their creation and keep the order?
It can be (hidden) configuration option, I guess it would be quick to implement?

The same applies to proposed "Show window previews on mouse hover" functionality (#574).

Thanks

enhancement

Most helpful comment

Hi, I just want to note.
If anyone wants to apply the patch [86f4404] to running ubuntu 18.04 without extensions enabled, it needs to just update file /usr/share/gnome-shell/extensions/[email protected]/windowPreview.js and restart gnome-shell (Alt + F2 and then r enter).

All 27 comments

The idea is that the fist window is always the active app, or the last used window. This is consistent with the behaviour of the alt+tab/alt+` window switcher. I agree it can be confusing at moments. I would need to play with this behaviour and see how it would work. Do you know what MS Windows does in its implementation?

For some reason I find that reordering annoying, not sure why. Maybe Mac OS doesn't reorder it. I will check it in Windows and Mac and report back. Thanks

Does MacOS have a similar feature? I didn't know that.

This is indeed the default behavior in windows as well as in dash-to-panel. While I understand the logic behind the current design, I think it would be nice to implement as a feature at least since it's less disorienting to users like me who are used to static ordering.
(It would be cool also to allow drag-and-drop reordering of window previews, although that's not a feature that's present in Windows either).

Sorry for taking it so long, I have tripple boot, but it's pain to reboot when I have lots of windows open.

Mac
mac

The menu after right-clicking. Currently selected window has a tick symbol, minimized one has a diamond symbol.

  • Hover : just displays an app title, quickly changing as you move over the icons
  • Left click: brings all app windows to foreground (minus minimized windows)
  • Right click: brings the app menu with list of all windows on the top. This list is statically ordered. Clicking on an item brings the window to foreground.

Windows

  • Hover : after a bit of delay the displays window previews with items statically ordered by window creation time.

    • Left click: just quickly display/hides window preview

  • Right click: shows app menu

So yes, the ordering is static in both OSes. I returned back to GNU/Linux after some time working on Mac so that's why I find this reorder annoying. :)

Maybe just highlight the last used / active window instead of putting it on top? That would always be useful, even if the current one is on top :)

Maybe this behavior can be configured via a setting. So the default behavior displays the most recent active window as fist and one can choose to not have the order of the window changed.

The same problem.
@micheleg, please, add this feature to your plans.

The reordering is really confusing to me and many of my colleagues that are experienced programers I kind of forced to upgrade to 18.04 also do suffer because of this issue, as one sometimes want to switch to another window and switch back just to find out that the top order of the windows has changed.
Honestly Ubuntu without this extension is lacking a lot and this feature... that it totally breaking any interactive design rules to my understanding is really pity to have to deal with.
I have now turned off previews that is default on Ubuntu and chosen switch windows instead but would really like to have previews with a static order.
Please prioritise this.
Can we maybe put together another pull request to just have this behaviour configurable or changed ? is merging changes to Ubuntu dash goes trough another approval process or merging here will at some point make its way to that branch as well?

@thenewnano @PureLines can yuo checkout this branch https://github.com/micheleg/dash-to-dock/tree/feature/windows_previews_static_order?

I have change the behaviour to be a stable order (from the first to the latest launched window I believe), which implies no separation between windows on different workspace is considered. This only applies to the dedicated popup menu (i.e. the onw available as a click option), which I believe is where the confusion mostly happens.

Is this the behaviour you are looking for? Does it work as expected?

Hi @micheleg YES!
Thank you , I just yesterday started trying out another plug in, now I feel back at home again!

I did check out the branch and run it and it is exactly how we wanted it to behave!
I tested also across workspaces, it also behaves as expected, window previews are now static and predictable.
Please merge this to master as soon as possible and I'll start migrating all users to dash to dock from Ubuntu dock for now.

Is this the behaviour you are looking for? Does it work as expected?

Yes! Thank you a lot, @micheleg!
Now it works perfectly!

I鈥檇 like us to get this merged in to the Ubuntu version this cycle too. Thank you very much for working on it!

I've tested the feature/windows_previews_static_order version as well and now the window preview works exactly how I would expect it to.
Would be nice to have this as an option in the release.

+1 for static order of windows in the dock. So unbearable having to click through similarly looking windows all day long, to find the one you need.

I've merged the branch in master [86f4404dffc] as the new and only behaviour, as it seems indeed more reasonable than the current one.

Hi, I just want to note.
If anyone wants to apply the patch [86f4404] to running ubuntu 18.04 without extensions enabled, it needs to just update file /usr/share/gnome-shell/extensions/[email protected]/windowPreview.js and restart gnome-shell (Alt + F2 and then r enter).

Hi, I'm running Dash to Dock v64 in gnome-tweak-tools extensions on ubuntu 18.10, and I'm still having windows re-order themselves by most recently used. How would I go about adding this patch to my machine?

Thank you so much @vainyksi !

Current patch that works on up-to-date 18.04:

--- windowPreview.js.orig   2019-01-21 11:39:02.000000000 +0100
+++ windowPreview.js    2019-08-14 12:10:32.207495268 +0200
@@ -188,15 +188,6 @@
     },

     _redisplay: function () {
-        // Remove separator
-        let nonWinItem = this._getMenuItems().filter(function(actor) {
-                return !actor._window;
-            });
-        for (let i = 0; i < nonWinItem.length; i++) {
-             let item = nonWinItem[i];
-             item.destroy();
-        }
-
         let children = this._getMenuItems().filter(function(actor) {
                 return actor._window;
             });
@@ -206,8 +197,10 @@
                 return actor._window;
             });

-        // All app windows
-        let newWin = this._source.getInterestingWindows().sort(this.sortWindowsCompareFunction);
+        // All app windows with a static order
+        let newWin = this._source.getInterestingWindows().sort(function(a, b) {
+            return a.get_stable_sequence() > b.get_stable_sequence();
+        });

         let addedItems = [];
         let removedActors = [];
@@ -271,26 +264,6 @@
                 item.actor.destroy();
         }

-        // Separate windows from other workspaces
-        let ws_index = global.screen.get_active_workspace_index();
-        let separator_index = 0;
-        for (let i = 0; i < newWin.length; i++)
-            if (newWin[i].get_workspace().index() == ws_index)
-                separator_index++;
-
-        if (separator_index > 0 && separator_index !== newWin.length) {
-            let separatorItem = new PopupMenu.PopupSeparatorMenuItem();
-            if (this.isHorizontal) {
-                separatorItem._separator.set_x_expand(false);
-                separatorItem._separator.set_y_expand(true);
-                separatorItem._separator.set_name('dashtodockPreviewSeparator');
-                separatorItem._separator.add_style_class_name('popup-separator-menu-item-horizontal');
-                separatorItem._separator.set_x_align(Clutter.ActorAlign.CENTER);
-                separatorItem._separator.set_y_align(Clutter.ActorAlign.FILL);
-            }
-            this.addMenuItem(separatorItem, separator_index);
-        }
-
         // Skip animations on first run when adding the initial set
         // of items, to avoid all items zooming in at once
         let animate = this._shownInitially;
@@ -346,18 +319,6 @@
         return this.actor.get_children().reduce(function(result, actor) {
                    return result || actor.animatingOut;
                }, false);
-    },
-
-    sortWindowsCompareFunction: function(windowA, windowB) {
-        let ws_index = global.screen.get_active_workspace_index();
-        let winA_inActiveWS = windowA.get_workspace().index() == ws_index;
-        let winB_inActiveWS = windowB.get_workspace().index() == ws_index;
-
-        // Only change the order if winA is not in the current WS, while winB is
-        if (!winA_inActiveWS && winB_inActiveWS)
-            return 1;
-
-        return 0;
     }
 });

Hi, I just want to note.
If anyone wants to apply the patch [86f4404] to running ubuntu 18.04 without extensions enabled, it needs to just update file /usr/share/gnome-shell/extensions/[email protected]/windowPreview.js and restart gnome-shell (Alt + 2 and then r enter).

Thanks for the help. It worked! Just to avoid confusion for others, it is Alt + F2

THANK YOU :D! This was really annoying...

Just to add, for someone like me who is new to applying patch files to code.

  1. Set your current working directory to /usr/share/gnome-shell/extensions/[email protected]/ using cd.
  2. Type sudo cp windowPreview.js windowPreview.js.old.
  3. Type sudo nano windowPreview_patch.
  4. Copy the git diff patch content from @bviktor above.
  5. Paste the contents in the nano.
  6. Save and exit nano.
  7. Type patch windowPreview.js windowPreview_patch
  8. Press ALT+F2
  9. Type "restart" or "r" for short.
  10. Press Enter.

Ubuntu 18.10
i changed windowPreview.js, restarted (Alt+F2) and i don't see any effect.
any thoughts?

My Gnome didn't restart.

got it fixed:
In patch: https://github.com/micheleg/dash-to-dock/commit/86f4404dffce054fbb3943b1faf6610306988eb8, do not modify L349
image

Was this page helpful?
0 / 5 - 0 ratings