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
This commit is contained in:
Florian Müllner
2019-07-02 21:20:01 +02:00
parent 6c49ca825c
commit f2b261c573
+18
View File
@@ -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() {