提交 40502ede 编写于 作者: I isidor

zenMode: options

上级 fb03c350
......@@ -90,7 +90,6 @@ export interface IWindowSettings {
openFilesInNewWindow: boolean;
reopenFolders: 'all' | 'one' | 'none';
restoreFullscreen: boolean;
fullScreenZenMode: boolean;
zoomLevel: number;
titleBarStyle: 'native' | 'custom';
autoDetectHighContrast: boolean;
......
......@@ -10,7 +10,7 @@ import { KeyCode, KeyMod, KeyChord } from 'vs/base/common/keyCodes';
import { Registry } from 'vs/platform/platform';
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actionRegistry';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { IPartService, IZenModeOptions } from 'vs/workbench/services/part/common/partService';
class ToggleZenMode extends Action {
......@@ -26,8 +26,8 @@ class ToggleZenMode extends Action {
this.enabled = !!this.partService;
}
public run(): TPromise<any> {
this.partService.toggleZenMode();
public run(options: IZenModeOptions): TPromise<any> {
this.partService.toggleZenMode(options);
return TPromise.as(null);
}
}
......
......@@ -186,11 +186,6 @@ let properties: { [path: string]: IJSONSchema; } = {
'default': false,
'description': nls.localize('restoreFullscreen', "Controls if a window should restore to full screen mode if it was exited in full screen mode.")
},
'window.fullScreenZenMode': {
'type': 'boolean',
'default': true,
'description': nls.localize('fullScreenZenMode', "Controls if turning on Zen Mode also puts the workbench into full screen mode.")
},
'window.zoomLevel': {
'type': 'number',
'default': 0,
......
......@@ -41,7 +41,7 @@ import { QuickOpenController } from 'vs/workbench/browser/parts/quickopen/quickO
import { getServices } from 'vs/platform/instantiation/common/extensions';
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
import { WorkbenchEditorService } from 'vs/workbench/services/editor/browser/editorService';
import { Position, Parts, IPartService, ILayoutOptions } from 'vs/workbench/services/part/common/partService';
import { Position, Parts, IPartService, ILayoutOptions, IZenModeOptions } from 'vs/workbench/services/part/common/partService';
import { IWorkspace, IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { ContextMenuService } from 'vs/workbench/services/contextview/electron-browser/contextmenuService';
......@@ -1047,21 +1047,28 @@ export class Workbench implements IPartService {
return Identifiers.WORKBENCH_CONTAINER;
}
public toggleZenMode(): void {
public toggleZenMode(options?: IZenModeOptions): void {
options = options || {};
this.zenMode.active = !this.zenMode.active;
// Check if zen mode transitioned to full screen and if now we are out of zen mode -> we need to go out of full screen
let toggleFullScreen = false;
if (this.zenMode.active) {
const windowConfig = this.configurationService.getConfiguration<IWindowConfiguration>();
toggleFullScreen = !browser.isFullscreen() && windowConfig.window.fullScreenZenMode;
toggleFullScreen = !browser.isFullscreen() && !options.noFullScreen;
this.zenMode.transitionedToFullScreen = toggleFullScreen;
this.zenMode.wasSideBarVisible = this.isVisible(Parts.SIDEBAR_PART);
this.zenMode.wasPanelVisible = this.isVisible(Parts.PANEL_PART);
this.setPanelHidden(true, true);
this.setSideBarHidden(true, true);
this.setActivityBarHidden(true, true);
this.setStatusBarHidden(true, true);
this.editorPart.hideTabs(true);
if (!options.keepStatusBar) {
this.setStatusBarHidden(true, true);
}
if (!options.keepActivityBar) {
this.setActivityBarHidden(true, true);
}
if (!options.keepTabs) {
this.editorPart.hideTabs(true);
}
} else {
if (this.zenMode.wasPanelVisible) {
this.setPanelHidden(false, true);
......
......@@ -27,6 +27,13 @@ export interface ILayoutOptions {
toggleMaximizedPanel?: boolean;
}
export interface IZenModeOptions {
noFullScreen?: boolean;
keepStatusBar?: boolean;
keepTabs?: boolean;
keepActivityBar?: boolean;
}
export const IPartService = createDecorator<IPartService>('partService');
export interface IPartService {
......@@ -116,5 +123,5 @@ export interface IPartService {
/**
* Toggles the workbench in and out of zen mode - parts get hidden and window goes fullscreen.
*/
toggleZenMode(): void;
toggleZenMode(options?: IZenModeOptions): void;
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册