Skip to content

Commit

Permalink
[keybinding] Align 'Close Editor' keybinding with VS Code across OSes
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Keromnes <jan.keromnes@typefox.io>
  • Loading branch information
jankeromnes committed Nov 29, 2019
1 parent 1805c55 commit 7a36f30
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/core/src/browser/common-frontend-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ import { AboutDialog } from './about-dialog';
import * as browser from './browser';
import URI from '../common/uri';
import { ContextKeyService } from './context-key-service';
import { OS, isOSX } from '../common/os';
import { OS, isOSX, isWindows } from '../common/os';
import { ResourceContextKey } from './resource-context-key';
import { UriSelection } from '../common/selection';
import { StorageService } from './storage-service';
import { Navigatable } from './navigatable';
import { QuickViewService } from './quick-view-service';
import { PrefixQuickOpenService } from './quick-open';
import { environment } from '@theia/application-package/lib/environment';

export namespace CommonMenus {

Expand Down Expand Up @@ -543,6 +544,10 @@ export class CommonFrontendContribution implements FrontendApplicationContributi
return tabBar.currentTitle || undefined;
}

private isElectron(): boolean {
return environment.electron.is();
}

registerKeybindings(registry: KeybindingRegistry): void {
if (supportCut) {
registry.registerKeybinding({
Expand Down Expand Up @@ -599,7 +604,7 @@ export class CommonFrontendContribution implements FrontendApplicationContributi
},
{
command: CommonCommands.CLOSE_TAB.id,
keybinding: 'alt+w'
keybinding: (!this.isElectron() ? 'alt+w' : (isWindows ? 'ctrl+f4' : 'ctrlcmd+w'))
},
{
command: CommonCommands.CLOSE_OTHER_TABS.id,
Expand Down

0 comments on commit 7a36f30

Please sign in to comment.