[gnome-shell] panel: focus windows on Escape key press



commit feed029ae471976aeeb7d4d5a6532a53f06437ca
Author: Stefano Facchini <stefano facchini gmail com>
Date:   Wed Nov 1 19:43:11 2017 +0100

    panel: focus windows on Escape key press
    
    https://bugzilla.gnome.org/show_bug.cgi?id=671121

 js/ui/panel.js |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/panel.js b/js/ui/panel.js
index e90d65b..d9b1a32 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -797,6 +797,7 @@ var Panel = new Lang.Class({
         this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
         this.actor.connect('allocate', Lang.bind(this, this._allocate));
         this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress));
+        this.actor.connect('key-press-event', Lang.bind(this, this._onKeyPress));
 
         Main.overview.connect('showing', Lang.bind(this, function () {
             this.actor.add_style_pseudo_class('overview');
@@ -964,6 +965,16 @@ var Panel = new Lang.Class({
         return Clutter.EVENT_STOP;
     },
 
+    _onKeyPress: function(actor, event) {
+        let symbol = event.get_key_symbol();
+        if (symbol == Clutter.KEY_Escape) {
+            global.screen.focus_default_window(event.get_time());
+            return Clutter.EVENT_STOP;
+        }
+
+        return Clutter.EVENT_PROPAGATE;
+    },
+
     _toggleMenu: function(indicator) {
         if (!indicator) // menu not supported by current session mode
             return;


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