mirror of
https://github.com/edu4rdshl/gnome-shell.git
synced 2026-07-18 07:34:54 +00:00
appMenu: Allow showing the window section for all windows
Since commit fd0da9606f, 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>
This commit is contained in:
parent
8b1e1834f0
commit
991d9597e0
1 changed files with 10 additions and 2 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue