[gnome-shell] appMenu: Allow showing the window section for all windows



commit 991d9597e0ba42aa972dd4161fa26025e8a0d17b
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Aug 12 21:25:49 2021 +0200

    appMenu: Allow showing the window section for all windows
    
    Since commit fd0da9606fd2, we only show the "Open Windows" section
    if there are at least two windows. That's another subtle difference
    with the overview context menus, but while limiting the section to
    a minimum of two windows makes sense where the menu always represents
    a running app, it is useful to show the section even for single windows
    in the dash/app grid.
    
    Account for both uses cases by adding a corresponding option to the
    constructor.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1948>

 js/ui/appMenu.js | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/appMenu.js b/js/ui/appMenu.js
index 3c363bf9cc..afd04d4b8f 100644
--- a/js/ui/appMenu.js
+++ b/js/ui/appMenu.js
@@ -9,8 +9,10 @@ var AppMenu = class AppMenu extends PopupMenu.PopupMenu {
     /**
      * @param {Clutter.Actor} sourceActor - actor the menu is attached to
      * @param {St.Side} side - arrow side
+     * @param {object} params - options
+     * @param {bool} params.showSingleWindow - show window section for a single window
      */
-    constructor(sourceActor, side = St.Side.TOP) {
+    constructor(sourceActor, side = St.Side.TOP, params = {}) {
         if (Clutter.get_default_text_direction() === Clutter.TextDirection.RTL) {
             if (side === St.Side.LEFT)
                 side = St.Side.RIGHT;
@@ -22,8 +24,13 @@ var AppMenu = class AppMenu extends PopupMenu.PopupMenu {
 
         this.actor.add_style_class_name('app-menu');
 
+        const {
+            showSingleWindows = false,
+        } = params;
+
         this._app = null;
         this._appSystem = Shell.AppSystem.get_default();
+        this._showSingleWindows = showSingleWindows;
 
         this._windowsChangedId = 0;
         this._updateWindowsLaterId = 0;
@@ -166,8 +173,9 @@ var AppMenu = class AppMenu extends PopupMenu.PopupMenu {
         if (!this._app)
             return;
 
+        const minWindows = this._showSingleWindows ? 1 : 2;
         const windows = this._app.get_windows().filter(w => !w.skip_taskbar);
-        if (windows.length < 2)
+        if (windows.length < minWindows)
             return;
 
         this._openWindowsHeader.show();


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