[gnome-shell] messageTray: Add a notification focus keybinding



commit 7dc235511e5e4624578fc38900185953080ecc00
Author: StÃphane DÃmurget <stephane demurget free fr>
Date:   Thu Nov 8 15:24:40 2012 +0100

    messageTray: Add a notification focus keybinding
    
    At the moment, only the mouse can be used to focus and answer a chat
    notification.
    
    This adds a new keybinding (defaults to <Super>+n) to focus and expand
    the active notification.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=652082

 data/50-gnome-shell-system.xml.in      |    3 +++
 data/org.gnome.shell.gschema.xml.in.in |    7 +++++++
 js/ui/messageTray.js                   |   11 +++++++++++
 3 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/data/50-gnome-shell-system.xml.in b/data/50-gnome-shell-system.xml.in
index cb468f9..92858c5 100644
--- a/data/50-gnome-shell-system.xml.in
+++ b/data/50-gnome-shell-system.xml.in
@@ -8,6 +8,9 @@
 	<KeyListEntry name="toggle-message-tray"
                       _description="Show the message tray"/>
 
+	<KeyListEntry name="focus-active-notification"
+                      _description="Focus the active notification"/>
+
 	<KeyListEntry name="toggle-application-view"
                       _description="Show all applications"/>
 
diff --git a/data/org.gnome.shell.gschema.xml.in.in b/data/org.gnome.shell.gschema.xml.in.in
index e18685e..eaeb01a 100644
--- a/data/org.gnome.shell.gschema.xml.in.in
+++ b/data/org.gnome.shell.gschema.xml.in.in
@@ -106,6 +106,13 @@ value here is from the GsmPresenceStatus enumeration.</_summary>
         Keybinding to toggle the visibility of the message tray.
       </_description>
     </key>
+    <key name="focus-active-notification" type="as">
+      <default>["&lt;Super&gt;n"]</default>
+      <_summary>Keybinding to focus the active notification</_summary>
+      <_description>
+        Keybinding to focus the active notification.
+      </_description>
+    </key>
     <key name="toggle-recording" type="as">
       <default><![CDATA[['<Control><Shift><Alt>r']]]></default>
       <_summary>Keybinding to toggle the screen recorder</_summary>
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 2bbdfe8..2f714b0 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -1519,6 +1519,10 @@ const MessageTray = new Lang.Class({
                                       new Gio.Settings({ schema: SHELL_KEYBINDINGS_SCHEMA }),
                                       Meta.KeyBindingFlags.NONE,
                                       Lang.bind(this, this.toggleAndNavigate));
+        global.display.add_keybinding('focus-active-notification',
+                                      new Gio.Settings({ schema: SHELL_KEYBINDINGS_SCHEMA }),
+                                      Meta.KeyBindingFlags.NONE,
+                                      Lang.bind(this, this._expandActiveNotification));
 
         this._summaryItems = [];
         this._chatSummaryItemsCount = 0;
@@ -2338,6 +2342,13 @@ const MessageTray = new Lang.Class({
             notification.destroy(NotificationDestroyedReason.EXPIRED);
     },
 
+    _expandActiveNotification: function() {
+        if (!this._notification)
+            return;
+
+        this._expandNotification(false);
+    },
+
     _expandNotification: function(autoExpanding) {
         // Don't grab focus in notifications that are auto-expanded.
         if (!autoExpanding)



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