[gnome-music] Use Ctrl+P and Ctrl+Space as play/pause shortcut.



commit 59d029dd6e9490b47fd0eacac80960082b346784
Author: Evandro Giovanini <efgiovanini gmail com>
Date:   Tue Mar 22 15:09:46 2016 -0300

    Use Ctrl+P and Ctrl+Space as play/pause shortcut.
    
    Use them instead of space. From Bastien Nocera on Bugzilla:
    "You really shouldn't be using unmodified shortcuts in a UI full of
    widgets. Totem gets away with it because that shortcut only works when
    the video view is visible.
    
    Eating Space unmodified will either not work properly, or break
    keyboard navigation (it's used to activate buttons, menus, etc.)."
    
    https://bugzilla.gnome.org/show_bug.cgi?id=754096

 gnomemusic/window.py |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index 7e91726..9a7395f 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -395,6 +395,10 @@ class Window(Gtk.ApplicationWindow):
             if (event.keyval == Gdk.KEY_f and
                     event_and_modifiers == Gdk.ModifierType.CONTROL_MASK):
                 self.toolbar.searchbar.toggle_bar()
+            # Play/pause on Ctrl + P and Ctrl + Space
+            if (event.keyval == Gdk.KEY_p or event.keyval == Gdk.KEY_space and
+                    event_and_modifiers == Gdk.ModifierType.CONTROL_MASK):
+                self.player.play_pause()
             # Go back from Album view on Alt + Left
             if (event.keyval == Gdk.KEY_Left and
                     event_and_modifiers == Gdk.ModifierType.MOD1_MASK):
@@ -414,17 +418,11 @@ class Window(Gtk.ApplicationWindow):
 
         # Open search bar when typing printable chars if it not opened
         # Make sure we skip unprintable chars and don't grab space press
-        # (this is used for play/pause)
         if not self.toolbar.searchbar.get_reveal_child() and not event.keyval == Gdk.KEY_space:
             if (event_and_modifiers == Gdk.ModifierType.SHIFT_MASK or
                     event_and_modifiers == 0) and \
                     GLib.unichar_isprint(chr(Gdk.keyval_to_unicode(event.keyval))):
                 self.toolbar.searchbar.show_bar(True)
-        else:
-            if not self.toolbar.searchbar.get_reveal_child():
-                if event.keyval == Gdk.KEY_space and self.player.actionbar.get_visible():
-                    if self.get_focus() != self.player.playBtn:
-                        self.player.play_pause()
 
     @log
     def _notify_mode_disconnect(self, data=None):


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