[gnome-tweaks] appmenu: Add F10 accelerator to open the menu



commit 7a034144f6c397cf78abedca29894632f55354ec
Author: Jeremy Bicha <jbicha ubuntu com>
Date:   Thu Jan 10 13:43:13 2019 -0500

    appmenu: Add F10 accelerator to open the menu

 gtweak/tweakview.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/gtweak/tweakview.py b/gtweak/tweakview.py
index 724410b..68cd9d7 100644
--- a/gtweak/tweakview.py
+++ b/gtweak/tweakview.py
@@ -27,6 +27,7 @@ class Window(Gtk.ApplicationWindow):
         right_box = self.main_content()
         separator = Gtk.Separator(orientation=Gtk.Orientation.VERTICAL)
 
+        self.menu_btn = Gtk.MenuButton()
         titlebar = self.titlebar()
         self.set_titlebar(titlebar)
 
@@ -90,12 +91,11 @@ class Window(Gtk.ApplicationWindow):
         self.builder.add_from_file(filename)
 
         appmenu = self.builder.get_object('appmenu')
-        menu_btn = Gtk.MenuButton()
         icon = Gtk.Image.new_from_gicon(Gio.ThemedIcon(name="open-menu-symbolic"),
                                         Gtk.IconSize.BUTTON)
-        menu_btn.set_image(icon)
-        menu_btn.set_menu_model(appmenu)
-        left_header.pack_end(menu_btn)
+        self.menu_btn.set_image(icon)
+        self.menu_btn.set_menu_model(appmenu)
+        left_header.pack_end(self.menu_btn)
 
         header.pack_start(left_header, False, False, 0)
         header.pack_start(Gtk.Separator(orientation=Gtk.Orientation.VERTICAL), False, False, 0)
@@ -228,6 +228,10 @@ class Window(Gtk.ApplicationWindow):
                 self.button.set_active(True)
                 return True
 
+        if keyname == 'F10':
+            self.menu_btn.activate()
+            return True
+
         return False
 
     def _on_list_changed(self, group):


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