[gnome-shell-extensions] window-list: Handle closing window picker with Escape
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell-extensions] window-list: Handle closing window picker with Escape
- Date: Tue, 2 Jul 2019 19:23:06 +0000 (UTC)
commit f2b261c5736e4a519e46b8ea2472756f028d9fec
Author: Florian Müllner <fmuellner gnome org>
Date: Tue Jul 2 18:12:31 2019 +0200
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 ba0a697..12a7627 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() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]