From f2b261c5736e4a519e46b8ea2472756f028d9fec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 2 Jul 2019 18:12:31 +0200 Subject: [PATCH] window-list: Handle closing window picker with Escape Just like the overview can be closed with Escape, it makes sense to allow the same for the window picker (in addition to pressing super repeatedly). https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/80 --- extensions/window-list/windowPicker.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/extensions/window-list/windowPicker.js b/extensions/window-list/windowPicker.js index ba0a6973..12a7627f 100644 --- a/extensions/window-list/windowPicker.js +++ b/extensions/window-list/windowPicker.js @@ -68,6 +68,7 @@ var WindowPicker = class { this._modal = false; this._overlayKeyId = 0; + this._stageKeyPressId = 0; this.actor = new Clutter.Actor(); @@ -132,6 +133,16 @@ var WindowPicker = class { this._fakeOverviewAnimation(); this._workspacesDisplay.show(false); + this._stageKeyPressId = global.stage.connect('key-press-event', + (a, event) => { + let sym = event.get_key_symbol(); + if (sym == Clutter.KEY_Escape) { + this.close(); + return Clutter.EVENT_STOP; + } + return Clutter.EVENT_PROPAGATE; + }); + this.emit('open-state-changed', this._visible); } @@ -151,6 +162,9 @@ var WindowPicker = class { this._fakeOverviewVisible(false); }); + global.stage.disconnect(this._stageKeyPressId); + this._stageKeyPressId = 0; + this.emit('open-state-changed', this._visible); } @@ -203,6 +217,10 @@ var WindowPicker = class { if (this._overlayKeyId) global.display.disconnect(this._overlayKeyId); this._overlayKeyId = 0; + + if (this._stageKeyPressId) + global.stage.disconnect(this._stageKeyPressId); + this._stageKeyPressId = 0; } _updateBackgrounds() {