From 958fb6fddccc60143a1fc8a69487353a3333e592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 11 Aug 2021 22:53:54 +0200 Subject: [PATCH] appsMenu: Add side parameter In order to re-use the menu in the overview, we must be able to change the side of the arrow, so expose the parent class parameter. Part-of: --- js/ui/appMenu.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/js/ui/appMenu.js b/js/ui/appMenu.js index a795e8e61..85c193bfe 100644 --- a/js/ui/appMenu.js +++ b/js/ui/appMenu.js @@ -1,6 +1,6 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- /* exported AppMenu */ -const { Gio, GLib, Meta, Shell, St } = imports.gi; +const { Clutter, Gio, GLib, Meta, Shell, St } = imports.gi; const PopupMenu = imports.ui.popupMenu; const Main = imports.ui.main; @@ -8,9 +8,17 @@ const Main = imports.ui.main; var AppMenu = class AppMenu extends PopupMenu.PopupMenu { /** * @param {Clutter.Actor} sourceActor - actor the menu is attached to + * @param {St.Side} side - arrow side */ - constructor(sourceActor) { - super(sourceActor, 0.5, St.Side.TOP); + constructor(sourceActor, side = St.Side.TOP) { + 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(sourceActor, 0.5, side); this.actor.add_style_class_name('app-menu');