Skip to content

Commit

Permalink
UI Overlap With window.nativeTabs: false, `window.commandCenter: tr…
Browse files Browse the repository at this point in the history
…ue`, and Tab per Project (fix #192801)
  • Loading branch information
bpasero committed Sep 12, 2023
1 parent 1d978fa commit 31a191b
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/vs/workbench/electron-sandbox/actions/windowActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { Action2, IAction2Options, MenuId } from 'vs/platform/actions/common/act
import { Categories } from 'vs/platform/action/common/actionCommonCategories';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { isMacintosh } from 'vs/base/common/platform';

export class CloseWindowAction extends Action2 {

Expand Down Expand Up @@ -276,26 +277,59 @@ export class QuickSwitchWindowAction extends BaseSwitchWindow {
}
}

function canRunNativeTabsHandler(accessor: ServicesAccessor): boolean {
if (!isMacintosh) {
return false;
}

const configurationService = accessor.get(IConfigurationService);
return configurationService.getValue<unknown>('window.nativeTabs') === true;
}

export const NewWindowTabHandler: ICommandHandler = function (accessor: ServicesAccessor) {
if (!canRunNativeTabsHandler(accessor)) {
return;
}

return accessor.get(INativeHostService).newWindowTab();
};

export const ShowPreviousWindowTabHandler: ICommandHandler = function (accessor: ServicesAccessor) {
if (!canRunNativeTabsHandler(accessor)) {
return;
}

return accessor.get(INativeHostService).showPreviousWindowTab();
};

export const ShowNextWindowTabHandler: ICommandHandler = function (accessor: ServicesAccessor) {
if (!canRunNativeTabsHandler(accessor)) {
return;
}

return accessor.get(INativeHostService).showNextWindowTab();
};

export const MoveWindowTabToNewWindowHandler: ICommandHandler = function (accessor: ServicesAccessor) {
if (!canRunNativeTabsHandler(accessor)) {
return;
}

return accessor.get(INativeHostService).moveWindowTabToNewWindow();
};

export const MergeWindowTabsHandlerHandler: ICommandHandler = function (accessor: ServicesAccessor) {
if (!canRunNativeTabsHandler(accessor)) {
return;
}

return accessor.get(INativeHostService).mergeAllWindowTabs();
};

export const ToggleWindowTabsBarHandler: ICommandHandler = function (accessor: ServicesAccessor) {
if (!canRunNativeTabsHandler(accessor)) {
return;
}

return accessor.get(INativeHostService).toggleWindowTabsBar();
};

0 comments on commit 31a191b

Please sign in to comment.