Skip to content

Commit

Permalink
expose workbenchState context key
Browse files Browse the repository at this point in the history
related to #35031
  • Loading branch information
joaomoreno committed Nov 28, 2017
1 parent bc174a7 commit 0ae072e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/vs/workbench/electron-browser/workbench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@ const Identifiers = {
STATUSBAR_PART: 'workbench.parts.statusbar'
};

function getWorkbenchStateString(state: WorkbenchState): string {
switch (state) {
case WorkbenchState.EMPTY: return 'empty';
case WorkbenchState.FOLDER: return 'folder';
case WorkbenchState.WORKSPACE: return 'workspace';
}
}

/**
* The workbench creates and lays out all parts that make up the workbench.
*/
Expand Down Expand Up @@ -269,6 +277,11 @@ export class Workbench implements IPartService {
this.inZenMode = InZenModeContext.bindTo(this.contextKeyService);
this.sideBarVisibleContext = SidebarVisibleContext.bindTo(this.contextKeyService);

// Set workbench state context
const WorkbenchStateContext = new RawContextKey<string>('workbenchState', getWorkbenchStateString(this.configurationService.getWorkbenchState()));
const workbenchStateContext = WorkbenchStateContext.bindTo(this.contextKeyService);
this.toDispose.push(this.configurationService.onDidChangeWorkbenchState(() => workbenchStateContext.set(getWorkbenchStateString(this.configurationService.getWorkbenchState()))));

// Register Listeners
this.registerListeners();

Expand Down

0 comments on commit 0ae072e

Please sign in to comment.