From 1e2532cf25197cc90720bd0267bbc9335fec6a0c Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Thu, 7 Jan 2021 10:05:18 -0300 Subject: [PATCH] dash/dashIcon: Popup menu above the icon Now that the Dash is horizontal, the popup menu of the Dash icons must show up, instead of left/right. Make AppIcon.popupMenu() receive an optional parameter with the side to show the menu, using St.Side.LEFT as default. Override this method in DashIcon to always pass St.Side.TOP. Part-of: --- js/ui/appDisplay.js | 15 +++++++++------ js/ui/dash.js | 4 ++++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index 4cfc13a7d..a2c6adaa0 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -2756,7 +2756,7 @@ var AppIcon = GObject.registerClass({ return this.app.get_id(); } - popupMenu() { + popupMenu(side = St.Side.LEFT) { this._removeMenuTimeout(); this.fake_release(); @@ -2764,7 +2764,7 @@ var AppIcon = GObject.registerClass({ this._draggable.fakeRelease(); if (!this._menu) { - this._menu = new AppIconMenu(this); + this._menu = new AppIconMenu(this, side); this._menu.connect('activate-window', (menu, window) => { this.activateWindow(window); }); @@ -2920,10 +2920,13 @@ var AppIcon = GObject.registerClass({ }); var AppIconMenu = class AppIconMenu extends PopupMenu.PopupMenu { - constructor(source) { - let side = St.Side.LEFT; - if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) - side = St.Side.RIGHT; + constructor(source, side) { + if (Clutter.get_default_text_direction() === Clutter.TextDirection.RTL) { + if (side === St.Side.LEFT) + side = St.Side.RIGHT; + else if (side === St.Side.RIGHT) + side = St.Side.LEFT; + } super(source, 0.5, side); diff --git a/js/ui/dash.js b/js/ui/dash.js index 3d6e75623..9c8639b28 100644 --- a/js/ui/dash.js +++ b/js/ui/dash.js @@ -31,6 +31,10 @@ class DashIcon extends AppDisplay.AppIcon { }); } + popupMenu() { + super.popupMenu(St.Side.BOTTOM); + } + // Disable scale-n-fade methods used during DND by parent scaleAndFade() { }