[gnome-shell-extensions] apps-menu: Stop using panel-main-menu shortcut



commit 7ba0e5b42c43edd7bdc0051ca7c101453e5d9525
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Jun 3 21:03:39 2021 +0200

    apps-menu: Stop using panel-main-menu shortcut
    
    It's an old GNOME 2 shortcut that's no longer worth supporting in
    the regular session. Instead, set up a new shortcut backed by our
    own schema.
    
    
https://discourse.gnome.org/t/difference-between-show-the-overview-and-show-the-activities-overview-keyboard-shortcuts/6572
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/173>

 extensions/apps-menu/extension.js                   | 21 +++++++--------------
 extensions/apps-menu/meson.build                    |  1 +
 extensions/apps-menu/metadata.json.in               |  1 +
 ...org.gnome.shell.extensions.apps-menu.gschema.xml | 12 ++++++++++++
 4 files changed, 21 insertions(+), 14 deletions(-)
---
diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
index fe9d5a2..2cbb754 100644
--- a/extensions/apps-menu/extension.js
+++ b/extensions/apps-menu/extension.js
@@ -378,9 +378,12 @@ class ApplicationsButton extends PanelMenu.Button {
         this._hidingId = Main.overview.connect('hiding', () => {
             this.remove_accessible_state(Atk.StateType.CHECKED);
         });
-        Main.layoutManager.connect('startup-complete',
-            this._setKeybinding.bind(this));
-        this._setKeybinding();
+        Main.wm.addKeybinding(
+            'apps-menu-toggle-menu',
+            ExtensionUtils.getSettings(),
+            Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
+            Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW,
+            () => this.menu.toggle());
 
         this._desktopTarget = new DesktopTarget();
         this._desktopTarget.connect('app-dropped', () => {
@@ -431,11 +434,7 @@ class ApplicationsButton extends PanelMenu.Button {
         this._tree.disconnect(this._treeChangedId);
         this._tree = null;
 
-        Main.wm.setCustomKeybindingHandler('panel-main-menu',
-            Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW,
-            Main.sessionMode.hasOverview
-                ? Main.overview.toggle.bind(Main.overview)
-                : null);
+        Main.wm.removeKeybinding('apps-menu-toggle-menu');
 
         this._desktopTarget.destroy();
     }
@@ -477,12 +476,6 @@ class ApplicationsButton extends PanelMenu.Button {
         super._onOpenStateChanged(menu, open);
     }
 
-    _setKeybinding() {
-        Main.wm.setCustomKeybindingHandler('panel-main-menu',
-            Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW,
-            () => this.menu.toggle());
-    }
-
     _redisplay() {
         this.applicationsBox.destroy_all_children();
         this.categoriesBox.destroy_all_children();
diff --git a/extensions/apps-menu/meson.build b/extensions/apps-menu/meson.build
index 48504f6..164b95e 100644
--- a/extensions/apps-menu/meson.build
+++ b/extensions/apps-menu/meson.build
@@ -3,3 +3,4 @@ extension_data += configure_file(
   output: metadata_name,
   configuration: metadata_conf
 )
+extension_schemas += files(metadata_conf.get('gschemaname') + '.gschema.xml')
diff --git a/extensions/apps-menu/metadata.json.in b/extensions/apps-menu/metadata.json.in
index f57a47f..b00cd3b 100644
--- a/extensions/apps-menu/metadata.json.in
+++ b/extensions/apps-menu/metadata.json.in
@@ -1,6 +1,7 @@
 {
 "extension-id": "@extension_id@",
 "uuid": "@uuid@",
+"settings-schema": "@gschemaname@",
 "gettext-domain": "@gettext_domain@",
 "name": "Applications Menu",
 "description": "Add a category-based menu for applications.\nThis extension is part of Classic Mode and is 
officially supported by GNOME. Please do not report bugs using the form below, use GNOME's GitLab instance 
instead.",
diff --git a/extensions/apps-menu/org.gnome.shell.extensions.apps-menu.gschema.xml 
b/extensions/apps-menu/org.gnome.shell.extensions.apps-menu.gschema.xml
new file mode 100644
index 0000000..b0cdb86
--- /dev/null
+++ b/extensions/apps-menu/org.gnome.shell.extensions.apps-menu.gschema.xml
@@ -0,0 +1,12 @@
+<schemalist gettext-domain="gnome-shell-extensions">
+  <schema id="org.gnome.shell.extensions.apps-menu"
+          path="/org/gnome/shell/extensions/apps-menu/">
+    <key name="apps-menu-toggle-menu" type="as">
+      <default>["&lt;Alt&gt;F1"]</default>
+      <summary>Keybinding to open the applications menu</summary>
+      <description>
+        Keybinding to open the applications menu.
+      </description>
+    </key>
+  </schema>
+</schemalist>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]