switcherPopup: Improve modifier-less keybinding navigation

Commit c899453800 lifted the requirement of switcher keybindings
to contain a modifier, however it is currently only possible to
finish it by letting it time out.

Improve that by also accepting space/enter key presses to confirm the
selection immediately.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1883
This commit is contained in:
Florian Müllner 2019-11-11 22:00:01 +01:00
parent a6e4ef862c
commit c752682ab9

View File

@ -180,6 +180,14 @@ var SwitcherPopup = GObject.registerClass({
if (keysym == Clutter.Escape || keysym == Clutter.Tab) if (keysym == Clutter.Escape || keysym == Clutter.Tab)
this.fadeAndDestroy(); this.fadeAndDestroy();
// Allow to explicitly select the current item; this is particularly
// useful for no-modifier popups
if (keysym === Clutter.KEY_space ||
keysym === Clutter.KEY_Return ||
keysym === Clutter.KEY_KP_Enter ||
keysym === Clutter.KEY_ISO_Enter)
this._finish(keyEvent.time);
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
} }