[gnome-shell] panel: Add keyboard shortcut to open app menu



commit c51acf7c2ab508133d02f99c617e076b7ba8c95b
Author: Florian MÃllner <fmuellner gnome org>
Date:   Tue Mar 27 15:26:20 2012 +0200

    panel: Add keyboard shortcut to open app menu
    
    With the application menu now being more than a stub, it has
    become a much more interesting target, so add a keyboard shortcut
    to open it directly.
    This should also ease some of the pain for focus-follows-mouse users.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=672909

 data/org.gnome.shell.gschema.xml.in |   12 ++++++++++++
 js/ui/panel.js                      |   10 ++++++++++
 js/ui/windowManager.js              |    9 +++++++++
 3 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/data/org.gnome.shell.gschema.xml.in b/data/org.gnome.shell.gschema.xml.in
index acf6ade..92a239f 100644
--- a/data/org.gnome.shell.gschema.xml.in
+++ b/data/org.gnome.shell.gschema.xml.in
@@ -64,6 +64,7 @@ value here is from the GsmPresenceStatus enumeration.</_summary>
     <child name="clock" schema="org.gnome.shell.clock"/>
     <child name="calendar" schema="org.gnome.shell.calendar"/>
     <child name="recorder" schema="org.gnome.shell.recorder"/>
+    <child name="keybindings" schema="org.gnome.shell.keybindings"/>
     <child name="keyboard" schema="org.gnome.shell.keyboard"/>
   </schema>
 
@@ -78,6 +79,17 @@ value here is from the GsmPresenceStatus enumeration.</_summary>
       </key>
   </schema>
 
+  <schema id="org.gnome.shell.keybindings" path="/org/gnome/shell/keybindings/"
+          gettext-domain="@GETTEXT_PACKAGE@">
+    <key name="open-application-menu" type="as">
+      <default>["&lt;Super&gt;F10"]</default>
+      <_summary>Keybinding to open the application menu</_summary>
+      <_description>
+        Keybinding to open the application menu.
+      </_description>
+    </key>
+  </schema>
+
   <schema id="org.gnome.shell.keyboard" path="/org/gnome/shell/keyboard/"
           gettext-domain="@GETTEXT_PACKAGE@">
     <key name="keyboard-type" type="s">
diff --git a/js/ui/panel.js b/js/ui/panel.js
index ef240a5..329f118 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -4,6 +4,7 @@ const Cairo = imports.cairo;
 const Clutter = imports.gi.Clutter;
 const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
+const Gtk = imports.gi.Gtk;
 const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 const Meta = imports.gi.Meta;
@@ -1112,6 +1113,15 @@ const Panel = new Lang.Class({
         return true;
     },
 
+    openAppMenu: function() {
+        let menu = this._appMenu.menu;
+        if (Main.overview.visible || menu.isOpen)
+          return;
+
+        menu.open();
+        menu.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
+    },
+
     startStatusArea: function() {
         for (let i = 0; i < this._status_area_order.length; i++) {
             let role = this._status_area_order[i];
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index 69f8e19..1e2b2f4 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -13,6 +13,7 @@ const WorkspaceSwitcherPopup = imports.ui.workspaceSwitcherPopup;
 const Main = imports.ui.main;
 const Tweener = imports.ui.tweener;
 
+const SHELL_KEYBINDINGS_SCHEMA = 'org.gnome.shell.keybindings';
 const WINDOW_ANIMATION_TIME = 0.25;
 const DIM_TIME = 0.500;
 const UNDIM_TIME = 0.250;
@@ -134,6 +135,10 @@ const WindowManager = new Lang.Class({
                                             Lang.bind(this, this._startAppSwitcher));
         Meta.keybindings_set_custom_handler('switch-panels',
                                             Lang.bind(this, this._startA11ySwitcher));
+        global.display.add_keybinding('open-application-menu',
+                                      SHELL_KEYBINDINGS_SCHEMA,
+                                      Meta.KeyBindingFlags.NONE,
+                                      Lang.bind(this, this._openAppMenu));
 
         Main.overview.connect('showing', Lang.bind(this, function() {
             for (let i = 0; i < this._dimmedWindows.length; i++)
@@ -547,6 +552,10 @@ const WindowManager = new Lang.Class({
         Main.ctrlAltTabManager.popup(backwards, binding.get_mask());
     },
 
+    _openAppMenu : function(display, screen, window, event, binding) {
+        Main.panel.openAppMenu();
+    },
+
     _showWorkspaceSwitcher : function(display, screen, window, binding) {
         if (screen.n_workspaces == 1)
             return;



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