Skip to content

Commit 8d88866

Browse files
authored
add icon, colors to settings profile status bar entry (microsoft#153308)
1 parent af06b93 commit 8d88866

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.ts

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,20 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6+
import { Codicon } from 'vs/base/common/codicons';
67
import { Event } from 'vs/base/common/event';
78
import { Disposable, DisposableStore, IDisposable, MutableDisposable } from 'vs/base/common/lifecycle';
89
import { ServicesAccessor } from 'vs/editor/browser/editorExtensions';
910
import { localize } from 'vs/nls';
1011
import { Action2, ISubmenuItem, MenuId, MenuRegistry, registerAction2 } from 'vs/platform/actions/common/actions';
1112
import { ContextKeyExpr, IContextKey, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
13+
import { registerColor } from 'vs/platform/theme/common/colorRegistry';
14+
import { themeColorFromId } from 'vs/platform/theme/common/themeService';
1215
import { IUserDataProfile, IUserDataProfilesService } from 'vs/platform/userDataProfile/common/userDataProfile';
1316
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
1417
import { WorkbenchStateContext } from 'vs/workbench/common/contextkeys';
1518
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
16-
import { IStatusbarEntryAccessor, IStatusbarService, StatusbarAlignment } from 'vs/workbench/services/statusbar/browser/statusbar';
19+
import { IStatusbarEntry, IStatusbarEntryAccessor, IStatusbarService, StatusbarAlignment } from 'vs/workbench/services/statusbar/browser/statusbar';
1720
import { IUserDataProfileManagementService, IUserDataProfileService, ManageProfilesSubMenu, PROFILES_CATEGORY, PROFILES_ENABLEMENT_CONTEXT, PROFILES_TTILE } from 'vs/workbench/services/userDataProfile/common/userDataProfile';
1821

1922
const CONTEXT_CURRENT_PROFILE = new RawContextKey<string>('currentUserDataProfile', '');
@@ -109,17 +112,20 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements
109112

110113
private profileStatusAccessor: IStatusbarEntryAccessor | undefined;
111114
private updateStatus(): void {
112-
if (this.userDataProfilesService.profiles.length > 1 && this.workspaceContextService.getWorkbenchState() !== WorkbenchState.EMPTY) {
113-
const statusBarEntry = {
114-
name: this.userDataProfileService.currentProfile.name!,
115+
if (this.userDataProfilesService.profiles.length && this.workspaceContextService.getWorkbenchState() !== WorkbenchState.EMPTY) {
116+
const statusBarEntry: IStatusbarEntry = {
117+
name: PROFILES_CATEGORY,
115118
command: 'workbench.profiles.actions.switchProfile',
116119
ariaLabel: localize('currentProfile', "Current Settings Profile is {0}", this.userDataProfileService.currentProfile.name),
117-
text: `${PROFILES_CATEGORY}: ${this.userDataProfileService.currentProfile.name!}`,
120+
text: `$(${Codicon.multipleWindows.id}) ${this.userDataProfileService.currentProfile.name!}`,
121+
tooltip: localize('profileTooltip', "{0}: {1}", PROFILES_CATEGORY, this.userDataProfileService.currentProfile.name),
122+
color: themeColorFromId(STATUS_BAR_SETTINGS_PROFILE_FOREGROUND),
123+
backgroundColor: themeColorFromId(STATUS_BAR_SETTINGS_PROFILE_BACKGROUND)
118124
};
119125
if (this.profileStatusAccessor) {
120126
this.profileStatusAccessor.update(statusBarEntry);
121127
} else {
122-
this.profileStatusAccessor = this.statusBarService.addEntry(statusBarEntry, 'status.userDataProfile', StatusbarAlignment.LEFT, 1);
128+
this.profileStatusAccessor = this.statusBarService.addEntry(statusBarEntry, 'status.userDataProfile', StatusbarAlignment.LEFT, Number.MAX_VALUE - 1);
123129
}
124130
} else {
125131
if (this.profileStatusAccessor) {
@@ -129,3 +135,17 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements
129135
}
130136
}
131137
}
138+
139+
const STATUS_BAR_SETTINGS_PROFILE_FOREGROUND = registerColor('statusBarItem.settingsProfilesForeground', {
140+
dark: null,
141+
light: null,
142+
hcDark: null,
143+
hcLight: null
144+
}, localize('statusBarItemSettingsProfileForeground', "Foreground color for the settings profile entry on the status bar."));
145+
146+
const STATUS_BAR_SETTINGS_PROFILE_BACKGROUND = registerColor('statusBarItem.settingsProfilesBackground', {
147+
dark: null,
148+
light: null,
149+
hcDark: null,
150+
hcLight: null
151+
}, localize('statusBarItemSettingsProfileBackground', "Background color for the settings profile entry on the status bar."));

0 commit comments

Comments
 (0)