From d878987d489b302bae0a437c5da6f37e41466230 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Fri, 1 May 2020 17:40:55 -0400 Subject: [PATCH] Add option to override escape key for Show Applications --- Settings.ui | 48 +++++++++++++++++++ panelManager.js | 3 +- prefs.js | 5 ++ ...shell.extensions.dash-to-panel.gschema.xml | 5 ++ taskbar.js | 14 ++++++ 5 files changed, 74 insertions(+), 1 deletion(-) diff --git a/Settings.ui b/Settings.ui index 5a702bd..6ef61c8 100644 --- a/Settings.ui +++ b/Settings.ui @@ -3936,6 +3936,54 @@ 1 + + + True + True + + + True + False + 12 + 12 + 12 + 12 + 32 + + + True + True + end + center + + + 1 + 0 + + + + + True + False + True + Override escape key and return to desktop + True + 0 + + + 0 + 0 + + + + + + + False + True + 2 + + 5000 diff --git a/panelManager.js b/panelManager.js index f9abcae..8f97e49 100755 --- a/panelManager.js +++ b/panelManager.js @@ -355,8 +355,9 @@ var dtpPanelManager = Utils.defineClass({ }, setFocusedMonitor: function(monitor, ignoreRelayout) { + this._needsIconAllocate = 1; + if (!this.checkIfFocusedMonitor(monitor)) { - this._needsIconAllocate = 1; Main.overview.viewSelector._workspacesDisplay._primaryIndex = monitor.index; Main.overview._overview.clear_constraints(); diff --git a/prefs.js b/prefs.js index 87dda60..12ec2f3 100644 --- a/prefs.js +++ b/prefs.js @@ -937,6 +937,7 @@ const Settings = new Lang.Class({ // restore default settings this._settings.set_value('show-apps-icon-side-padding', this._settings.get_default_value('show-apps-icon-side-padding')); this._builder.get_object('show_applications_side_padding_spinbutton').set_value(this._settings.get_int('show-apps-icon-side-padding')); + this._settings.set_value('show-apps-override-escape', this._settings.get_default_value('show-apps-override-escape')); handleIconChange.call(this, null); } else { // remove the settings box so it doesn't get destroyed; @@ -957,6 +958,10 @@ const Settings = new Lang.Class({ this._builder.get_object('application_button_animation_button'), 'sensitive', Gio.SettingsBindFlags.DEFAULT); + this._settings.bind('show-apps-override-escape', + this._builder.get_object('show_applications_esc_key_switch'), + 'active', + Gio.SettingsBindFlags.DEFAULT); this._settings.bind('show-activities-button', this._builder.get_object('show_activities_button_switch'), 'active', diff --git a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml index 461cf62..dd6b8ab 100644 --- a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml +++ b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml @@ -367,6 +367,11 @@ Show Applications icon side padding Customize the Show Applications icon side padding + + true + Override escape key + Override the escape key to return to the desktop when entering the overview using the Show Applications button + true Animate Show Applications from the desktop diff --git a/taskbar.js b/taskbar.js index abc84d4..50d1914 100644 --- a/taskbar.js +++ b/taskbar.js @@ -1112,6 +1112,19 @@ var taskbar = Utils.defineClass({ }); if (this.showAppsButton.checked) { + if (Me.settings.get_boolean('show-apps-override-escape')) { + //override escape key to return to the desktop when entering the overview using the showapps button + Main.overview.viewSelector._onStageKeyPress = function(actor, event) { + if (Main.modalCount == 1 && event.get_key_symbol() === Clutter.KEY_Escape) { + this._searchActive ? this.reset() : Main.overview.hide(); + + return Clutter.EVENT_STOP; + } + + return this.__proto__._onStageKeyPress.call(this, actor, event); + }; + } + // force spring animation triggering.By default the animation only // runs if we are already inside the overview. if (!Main.overview._shown) { @@ -1156,6 +1169,7 @@ var taskbar = Utils.defineClass({ let overviewHiddenId = Main.overview.connect('hidden', () => { Main.overview.disconnect(overviewHiddenId); this.dtpPanel.panelManager.setFocusedMonitor(this.dtpPanel.panelManager.primaryPanel.monitor, true); + delete Main.overview.viewSelector._onStageKeyPress; }); // Finally show the overview