From 3ad660927f2dea3eaff3e4738179ecb7c92da255 Mon Sep 17 00:00:00 2001 From: Alberto Iannaccone Date: Tue, 29 Nov 2022 09:22:14 +0100 Subject: [PATCH] Fix keybindings to switch between tabs on MacOs (#1686) --- .../core/common-frontend-contribution.ts | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/arduino-ide-extension/src/browser/theia/core/common-frontend-contribution.ts b/arduino-ide-extension/src/browser/theia/core/common-frontend-contribution.ts index 0785cad03..98d6d49e6 100644 --- a/arduino-ide-extension/src/browser/theia/core/common-frontend-contribution.ts +++ b/arduino-ide-extension/src/browser/theia/core/common-frontend-contribution.ts @@ -6,6 +6,8 @@ import { } from '@theia/core/lib/browser/common-frontend-contribution'; import { CommandRegistry } from '@theia/core/lib/common/command'; import type { OnWillStopAction } from '@theia/core/lib/browser/frontend-application'; +import { KeybindingRegistry } from '@theia/core/lib/browser'; +import { isOSX } from '@theia/core'; @injectable() export class CommonFrontendContribution extends TheiaCommonFrontendContribution { @@ -50,6 +52,36 @@ export class CommonFrontendContribution extends TheiaCommonFrontendContribution } } + override registerKeybindings(registry: KeybindingRegistry): void { + super.registerKeybindings(registry); + // Workaround for https://github.com/eclipse-theia/theia/issues/11875 + if (isOSX) { + registry.unregisterKeybinding('ctrlcmd+tab'); + registry.unregisterKeybinding('ctrlcmd+alt+d'); + registry.unregisterKeybinding('ctrlcmd+shift+tab'); + registry.unregisterKeybinding('ctrlcmd+alt+a'); + + registry.registerKeybindings( + { + command: CommonCommands.NEXT_TAB.id, + keybinding: 'ctrl+tab', + }, + { + command: CommonCommands.NEXT_TAB.id, + keybinding: 'ctrl+alt+d', + }, + { + command: CommonCommands.PREVIOUS_TAB.id, + keybinding: 'ctrl+shift+tab', + }, + { + command: CommonCommands.PREVIOUS_TAB.id, + keybinding: 'ctrl+alt+a', + } + ); + } + } + override onWillStop(): OnWillStopAction | undefined { // This is NOOP here. All window close and app quit requests are handled in the `Close` contribution. return undefined;