Merge pull request #44116 from SrTobi-Forks/centered-zen
Setting to center the layout when turning on the zen mode
This commit is contained in:
commit
32b28ce90b
2 changed files with 21 additions and 2 deletions
|
@ -408,6 +408,11 @@ configurationRegistry.registerConfiguration({
|
|||
'default': true,
|
||||
'description': nls.localize('zenMode.fullScreen', "Controls if turning on Zen Mode also puts the workbench into full screen mode.")
|
||||
},
|
||||
'zenMode.centeredLayout': {
|
||||
'type': 'boolean',
|
||||
'default': true,
|
||||
'description': nls.localize('zenMode.centeredLayout', "Controls if turning on Zen Mode also centers the layout.")
|
||||
},
|
||||
'zenMode.hideTabs': {
|
||||
'type': 'boolean',
|
||||
'default': true,
|
||||
|
|
|
@ -117,6 +117,7 @@ interface WorkbenchParams {
|
|||
|
||||
interface IZenModeSettings {
|
||||
fullScreen: boolean;
|
||||
centeredLayout: boolean;
|
||||
hideTabs: boolean;
|
||||
hideActivityBar: boolean;
|
||||
hideStatusBar: boolean;
|
||||
|
@ -217,6 +218,7 @@ export class Workbench implements IPartService {
|
|||
private zenMode: {
|
||||
active: boolean;
|
||||
transitionedToFullScreen: boolean;
|
||||
transitionedToCenteredEditorLayout: boolean;
|
||||
wasSideBarVisible: boolean;
|
||||
wasPanelVisible: boolean;
|
||||
};
|
||||
|
@ -668,6 +670,7 @@ export class Workbench implements IPartService {
|
|||
this.zenMode = {
|
||||
active: false,
|
||||
transitionedToFullScreen: false,
|
||||
transitionedToCenteredEditorLayout: false,
|
||||
wasSideBarVisible: false,
|
||||
wasPanelVisible: false
|
||||
};
|
||||
|
@ -1315,10 +1318,14 @@ export class Workbench implements IPartService {
|
|||
|
||||
// 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;
|
||||
// Same goes for the centered editor layout
|
||||
let toggleCenteredEditorLayout = false;
|
||||
if (this.zenMode.active) {
|
||||
const config = this.configurationService.getValue<IZenModeSettings>('zenMode');
|
||||
toggleFullScreen = !browser.isFullscreen() && config.fullScreen;
|
||||
this.zenMode.transitionedToFullScreen = toggleFullScreen;
|
||||
toggleCenteredEditorLayout = !this.isEditorLayoutCentered() && config.centeredLayout;
|
||||
this.zenMode.transitionedToCenteredEditorLayout = toggleCenteredEditorLayout;
|
||||
this.zenMode.wasSideBarVisible = this.isVisible(Parts.SIDEBAR_PART);
|
||||
this.zenMode.wasPanelVisible = this.isVisible(Parts.PANEL_PART);
|
||||
this.setPanelHidden(true, true).done(void 0, errors.onUnexpectedError);
|
||||
|
@ -1353,10 +1360,15 @@ export class Workbench implements IPartService {
|
|||
}
|
||||
|
||||
toggleFullScreen = this.zenMode.transitionedToFullScreen && browser.isFullscreen();
|
||||
toggleCenteredEditorLayout = this.zenMode.transitionedToCenteredEditorLayout && this.isEditorLayoutCentered();
|
||||
}
|
||||
|
||||
this.inZenMode.set(this.zenMode.active);
|
||||
|
||||
if (toggleCenteredEditorLayout) {
|
||||
this.toggleCenteredEditorLayout(true);
|
||||
}
|
||||
|
||||
if (!skipLayout) {
|
||||
this.layout();
|
||||
}
|
||||
|
@ -1370,11 +1382,13 @@ export class Workbench implements IPartService {
|
|||
return this.centeredEditorLayoutActive;
|
||||
}
|
||||
|
||||
public toggleCenteredEditorLayout(): void {
|
||||
public toggleCenteredEditorLayout(skipLayout?: boolean): void {
|
||||
this.centeredEditorLayoutActive = !this.centeredEditorLayoutActive;
|
||||
this.storageService.store(Workbench.centeredEditorLayoutActiveStorageKey, this.centeredEditorLayoutActive, StorageScope.GLOBAL);
|
||||
|
||||
this.layout();
|
||||
if (!skipLayout) {
|
||||
this.layout();
|
||||
}
|
||||
}
|
||||
|
||||
// Resize requested part along the main axis
|
||||
|
|
Loading…
Reference in a new issue