Fix keybindings to switch between tabs on MacOs (#1686)

This commit is contained in:
Alberto Iannaccone 2022-11-29 09:22:14 +01:00 committed by GitHub
parent 8778d70ad7
commit 3ad660927f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,6 +6,8 @@ import {
} from '@theia/core/lib/browser/common-frontend-contribution'; } from '@theia/core/lib/browser/common-frontend-contribution';
import { CommandRegistry } from '@theia/core/lib/common/command'; import { CommandRegistry } from '@theia/core/lib/common/command';
import type { OnWillStopAction } from '@theia/core/lib/browser/frontend-application'; import type { OnWillStopAction } from '@theia/core/lib/browser/frontend-application';
import { KeybindingRegistry } from '@theia/core/lib/browser';
import { isOSX } from '@theia/core';
@injectable() @injectable()
export class CommonFrontendContribution extends TheiaCommonFrontendContribution { 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 { override onWillStop(): OnWillStopAction | undefined {
// This is NOOP here. All window close and app quit requests are handled in the `Close` contribution. // This is NOOP here. All window close and app quit requests are handled in the `Close` contribution.
return undefined; return undefined;