[totem/wip/hadess/keyboard-shortcuts] main: Add 'M' shortcut to toggle mute




commit d7897c4e9b0a58b338b23e349fb7353a81f1595d
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Feb 15 15:07:02 2022 +0100

    main: Add 'M' shortcut to toggle mute
    
    'M' was already used for the (increasingly rare) "go to root menu of a
    DVD", so mute is only toggled when not playing a DVD.
    
    This is the same shortcut as YouTube uses:
    https://support.google.com/youtube/answer/7631406?hl=en
    
    Closes: #457

 README             | 2 ++
 data/shortcuts.ui  | 7 +++++++
 src/totem-object.c | 5 ++++-
 3 files changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/README b/README
index 017859b1f..4ab0a8eaa 100644
--- a/README
+++ b/README
@@ -29,6 +29,8 @@ Ctrl+H:
        Shortcut help
 
 Undocumented shortcuts:
+M (when playing a DVD):
+       Menu
 Ctrl+Q:
        Quit
 Ctrl+W:
diff --git a/data/shortcuts.ui b/data/shortcuts.ui
index 03022ced1..adaa4e302 100644
--- a/data/shortcuts.ui
+++ b/data/shortcuts.ui
@@ -62,6 +62,13 @@
                 <property name="title" translatable="yes" context="shortcut window">Decrease 
volume</property>
               </object>
             </child>
+            <child>
+              <object class="GtkShortcutsShortcut" id="toggle-volume">
+                <property name="visible">1</property>
+                <property name="accelerator">M</property>
+                <property name="title" translatable="yes" context="shortcut window">Mute/unmute</property>
+              </object>
+            </child>
           </object>
         </child>
         <child>
diff --git a/src/totem-object.c b/src/totem-object.c
index 03e3b0b66..61afe50cb 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -3469,7 +3469,10 @@ totem_object_handle_key_press (TotemObject *totem, GdkEventKey *event)
                break;
        case GDK_KEY_M:
        case GDK_KEY_m:
-               bacon_video_widget_dvd_event (totem->bvw, BVW_DVD_ROOT_MENU);
+               if (totem_playing_dvd (totem->mrl))
+                       bacon_video_widget_dvd_event (totem->bvw, BVW_DVD_ROOT_MENU);
+               else
+                       totem_object_volume_toggle_mute (totem);
                break;
        case GDK_KEY_AudioNext:
        case GDK_KEY_Forward:


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