From 6105eecff26030519dbcf22c7e6ff39aecd8dc87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 29 May 2019 08:32:03 +0000 Subject: [PATCH] apps-menu: Stop taking over Activities button We don't want the "Activities" button in GNOME Classic, but the current way of handling it is confusing: - the button is hidden, but the corresponding hot corner sometimes works (when the application menu isn't open) - the button is effectively moved inside the menu, although it's clearly not an app or category - the apps-menu can be used independent from classic mode, in which case removing the "Activities" button may not be wanted Address those points by removing any handling of the activities button from the apps-menu extension. We will remove it again from the classic session via a session mode tweak. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/69 --- extensions/apps-menu/extension.js | 59 ++----------------------------- 1 file changed, 2 insertions(+), 57 deletions(-) diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js index 685e885a..c4d62750 100644 --- a/extensions/apps-menu/extension.js +++ b/extensions/apps-menu/extension.js @@ -25,21 +25,6 @@ const NAVIGATION_REGION_OVERSHOOT = 50; Gio._promisify(Gio._LocalFilePrototype, 'query_info_async', 'query_info_finish'); Gio._promisify(Gio._LocalFilePrototype, 'set_attributes_async', 'set_attributes_finish'); -var ActivitiesMenuItem = GObject.registerClass( -class ActivitiesMenuItem extends PopupMenu.PopupBaseMenuItem { - _init(button) { - super._init(); - this._button = button; - this.add_child(new St.Label({ text: _('Activities Overview') })); - } - - activate(event) { - this._button.menu.toggle(); - Main.overview.toggle(); - super.activate(event); - } -}); - var ApplicationMenuItem = GObject.registerClass( class ApplicationMenuItem extends PopupMenu.PopupBaseMenuItem { _init(button, app) { @@ -233,21 +218,6 @@ class ApplicationsMenu extends PopupMenu.PopupMenu { return false; } - open(animate) { - this._button.hotCorner.setBarrierSize(0); - if (this._button.hotCorner.actor) // fallback corner - this._button.hotCorner.actor.hide(); - super.open(animate); - } - - close(animate) { - let size = Main.layoutManager.panelBox.height; - this._button.hotCorner.setBarrierSize(size); - if (this._button.hotCorner.actor) // fallback corner - this._button.hotCorner.actor.show(); - super.close(animate); - } - toggle() { if (this.isOpen) { this._button.selectCategory(null); @@ -406,8 +376,6 @@ class ApplicationsButton extends PanelMenu.Button { this.name = 'panelApplications'; this.label_actor = this._label; - this.connect('captured-event', this._onCapturedEvent.bind(this)); - this._showingId = Main.overview.connect('showing', () => { this.add_accessible_state (Atk.StateType.CHECKED); }); @@ -449,10 +417,6 @@ class ApplicationsButton extends PanelMenu.Button { } } - get hotCorner() { - return Main.layoutManager.hotCorners[Main.layoutManager.primaryIndex]; - } - _createVertSeparator() { let separator = new St.DrawingArea({ style_class: 'calendar-vertical-separator', @@ -480,14 +444,6 @@ class ApplicationsButton extends PanelMenu.Button { this._desktopTarget.destroy(); } - _onCapturedEvent(actor, event) { - if (event.type() == Clutter.EventType.BUTTON_PRESS) { - if (!Main.overview.shouldToggleByCornerOrButton()) - return true; - } - return false; - } - _onMenuKeyPress(actor, event) { let symbol = event.get_key_symbol(); if (symbol == Clutter.KEY_Left || symbol == Clutter.KEY_Right) { @@ -630,14 +586,6 @@ class ApplicationsButton extends PanelMenu.Button { y_align: St.Align.START }); - let activities = new ActivitiesMenuItem(this); - this.leftBox.add(activities, { - expand: false, - x_fill: true, - y_fill: false, - y_align: St.Align.START - }); - this.applicationsBox = new St.BoxLayout({ vertical: true }); this.applicationsScrollBox.add_actor(this.applicationsBox); this.categoriesBox = new St.BoxLayout({ vertical: true }); @@ -749,19 +697,16 @@ class ApplicationsButton extends PanelMenu.Button { }); let appsMenuButton; -let activitiesButton; function enable() { - activitiesButton = Main.panel.statusArea['activities']; - activitiesButton.container.hide(); appsMenuButton = new ApplicationsButton(); - Main.panel.addToStatusArea('apps-menu', appsMenuButton, 1, 'left'); + let index = Main.sessionMode.panel.left.indexOf('activities') + 1; + Main.panel.addToStatusArea('apps-menu', appsMenuButton, index, 'left'); } function disable() { Main.panel.menuManager.removeMenu(appsMenuButton.menu); appsMenuButton.destroy(); - activitiesButton.container.show(); } function init() {