Skip to content

Commit

Permalink
Fix keybindings to switch between tabs on MacOs (#1686)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alberto Iannaccone authored Nov 29, 2022
1 parent 8778d70 commit 3ad6609
Showing 1 changed file with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 3ad6609

Please sign in to comment.