overviewControls: Handle keyboard navigation

The old view selector used to handle initiating keynav into pages.
That code became inactive when non-search related functionality
was moved elsewhere, and was finally removed in commit cf41f4a527.

We still want the keynav behavior it provided, so add similar code
to overview's control manager.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4056

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2124>
This commit is contained in:
Florian Müllner 2022-01-24 17:00:36 +01:00 committed by Marge Bot
parent 7d43038312
commit 1cee7e6760

View File

@ -435,6 +435,41 @@ class ControlsManager extends St.Widget {
Main.overview.toggle(); Main.overview.toggle();
}); });
// connect_after to give search controller first dibs on the event
global.stage.connect_after('key-press-event', (actor, event) => {
if (this._searchController.searchActive)
return Clutter.EVENT_PROPAGATE;
if (global.stage.key_focus &&
!this.contains(global.stage.key_focus))
return Clutter.EVENT_PROPAGATE;
const { finalState } =
this._stateAdjustment.getStateTransitionParams();
let keynavDisplay;
if (finalState === ControlsState.WINDOW_PICKER)
keynavDisplay = this._workspacesDisplay;
else if (finalState === ControlsState.APP_GRID)
keynavDisplay = this._appDisplay;
if (!keynavDisplay)
return Clutter.EVENT_PROPAGATE;
const symbol = event.get_key_symbol();
if (symbol === Clutter.KEY_Tab || symbol === Clutter.KEY_Down) {
keynavDisplay.navigate_focus(
null, St.DirectionType.TAB_FORWARD, false);
return Clutter.EVENT_STOP;
} else if (symbol === Clutter.KEY_ISO_Left_Tab) {
keynavDisplay.navigate_focus(
null, St.DirectionType.TAB_BACKWARD, false);
return Clutter.EVENT_STOP;
}
return Clutter.EVENT_PROPAGATE;
});
Main.wm.addKeybinding( Main.wm.addKeybinding(
'toggle-application-view', 'toggle-application-view',
new Gio.Settings({ schema_id: WindowManager.SHELL_KEYBINDINGS_SCHEMA }), new Gio.Settings({ schema_id: WindowManager.SHELL_KEYBINDINGS_SCHEMA }),