@codingame/monaco-vscode-view-title-bar-service-override 4.1.0 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
- package/external/tslib/tslib.es6.js +11 -0
- package/package.json +2 -2
- package/viewTitleBar.js +1 -1
- package/vscode/src/vs/workbench/browser/parts/titlebar/commandCenterControl.js +222 -0
- package/vscode/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/titlebar/titlebarActions.js +261 -0
- package/vscode/src/vs/workbench/browser/parts/titlebar/titlebarPart.js +584 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=( Object.keys(r.attributes)),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
|
|
2
|
+
|
|
3
|
+
export { n as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
function __decorate(decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
}
|
|
7
|
+
function __param(paramIndex, decorator) {
|
|
8
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { __decorate, __param };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-view-title-bar-service-override",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.1",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -18,6 +18,6 @@
|
|
|
18
18
|
"module": "index.js",
|
|
19
19
|
"types": "index.d.ts",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"vscode": "npm:@codingame/monaco-vscode-api@4.1.
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@4.1.1"
|
|
22
22
|
}
|
|
23
23
|
}
|
package/viewTitleBar.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
2
|
-
import { BrowserTitleService } from 'vscode/
|
|
2
|
+
import { BrowserTitleService } from './vscode/src/vs/workbench/browser/parts/titlebar/titlebarPart.js';
|
|
3
3
|
import { ITitleService } from 'vscode/vscode/vs/workbench/services/title/browser/titleService';
|
|
4
4
|
import { registerServiceInitializePostParticipant } from 'vscode/lifecycle';
|
|
5
5
|
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { reset, isActiveDocument } from 'vscode/vscode/vs/base/browser/dom';
|
|
3
|
+
import { BaseActionViewItem } from 'vscode/vscode/vs/base/browser/ui/actionbar/actionViewItems';
|
|
4
|
+
import { getDefaultHoverDelegate } from 'vscode/vscode/vs/base/browser/ui/hover/hoverDelegateFactory';
|
|
5
|
+
import { setupCustomHover } from 'vscode/vscode/vs/base/browser/ui/hover/updatableHoverWidget';
|
|
6
|
+
import { renderIcon } from 'vscode/vscode/vs/base/browser/ui/iconLabel/iconLabels';
|
|
7
|
+
import { SubmenuAction } from 'vscode/vscode/vs/base/common/actions';
|
|
8
|
+
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
9
|
+
import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
|
|
10
|
+
import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
11
|
+
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
12
|
+
import { createActionViewItem } from 'vscode/vscode/vs/platform/actions/browser/menuEntryActionViewItem';
|
|
13
|
+
import { WorkbenchToolBar, MenuWorkbenchToolBar } from 'vscode/vscode/vs/platform/actions/browser/toolbar';
|
|
14
|
+
import { MenuRegistry, MenuId, SubmenuItemAction } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
15
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
16
|
+
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
|
|
17
|
+
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
|
|
18
|
+
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
|
|
19
|
+
|
|
20
|
+
var CommandCenterCenterViewItem_1;
|
|
21
|
+
let CommandCenterControl = class CommandCenterControl {
|
|
22
|
+
constructor(windowTitle, hoverDelegate, instantiationService, quickInputService) {
|
|
23
|
+
this._disposables = ( new DisposableStore());
|
|
24
|
+
this._onDidChangeVisibility = ( new Emitter());
|
|
25
|
+
this.onDidChangeVisibility = this._onDidChangeVisibility.event;
|
|
26
|
+
this.element = document.createElement('div');
|
|
27
|
+
this.element.classList.add('command-center');
|
|
28
|
+
const titleToolbar = instantiationService.createInstance(MenuWorkbenchToolBar, this.element, MenuId.CommandCenter, {
|
|
29
|
+
contextMenu: MenuId.TitleBarContext,
|
|
30
|
+
hiddenItemStrategy: -1 ,
|
|
31
|
+
toolbarOptions: {
|
|
32
|
+
primaryGroup: () => true,
|
|
33
|
+
},
|
|
34
|
+
telemetrySource: 'commandCenter',
|
|
35
|
+
actionViewItemProvider: (action, options) => {
|
|
36
|
+
if (action instanceof SubmenuItemAction && action.item.submenu === MenuId.CommandCenterCenter) {
|
|
37
|
+
return instantiationService.createInstance(CommandCenterCenterViewItem, action, windowTitle, { ...options, hoverDelegate });
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
return createActionViewItem(instantiationService, action, { ...options, hoverDelegate });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
this._disposables.add(Event.filter(quickInputService.onShow, () => isActiveDocument(this.element), this._disposables)(this._setVisibility.bind(this, false)));
|
|
45
|
+
this._disposables.add(Event.filter(quickInputService.onHide, () => isActiveDocument(this.element), this._disposables)(this._setVisibility.bind(this, true)));
|
|
46
|
+
this._disposables.add(titleToolbar);
|
|
47
|
+
}
|
|
48
|
+
_setVisibility(show) {
|
|
49
|
+
this.element.classList.toggle('hide', !show);
|
|
50
|
+
this._onDidChangeVisibility.fire();
|
|
51
|
+
}
|
|
52
|
+
dispose() {
|
|
53
|
+
this._disposables.dispose();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
CommandCenterControl = ( __decorate([
|
|
57
|
+
( __param(2, IInstantiationService)),
|
|
58
|
+
( __param(3, IQuickInputService))
|
|
59
|
+
], CommandCenterControl));
|
|
60
|
+
let CommandCenterCenterViewItem = class CommandCenterCenterViewItem extends BaseActionViewItem {
|
|
61
|
+
static { CommandCenterCenterViewItem_1 = this; }
|
|
62
|
+
static { this._quickOpenCommandId = 'workbench.action.quickOpenWithModes'; }
|
|
63
|
+
constructor(_submenu, _windowTitle, options, _keybindingService, _instaService, _editorGroupService) {
|
|
64
|
+
super(undefined, _submenu.actions.find(action => action.id === 'workbench.action.quickOpenWithModes') ?? _submenu.actions[0], options);
|
|
65
|
+
this._submenu = _submenu;
|
|
66
|
+
this._windowTitle = _windowTitle;
|
|
67
|
+
this._keybindingService = _keybindingService;
|
|
68
|
+
this._instaService = _instaService;
|
|
69
|
+
this._editorGroupService = _editorGroupService;
|
|
70
|
+
this._hoverDelegate = options.hoverDelegate ?? getDefaultHoverDelegate('mouse');
|
|
71
|
+
}
|
|
72
|
+
render(container) {
|
|
73
|
+
super.render(container);
|
|
74
|
+
container.classList.add('command-center-center');
|
|
75
|
+
container.classList.toggle('multiple', (this._submenu.actions.length > 1));
|
|
76
|
+
const hover = this._store.add(setupCustomHover(this._hoverDelegate, container, this.getTooltip()));
|
|
77
|
+
this._store.add(this._windowTitle.onDidChange(() => {
|
|
78
|
+
hover.update(this.getTooltip());
|
|
79
|
+
}));
|
|
80
|
+
const groups = [];
|
|
81
|
+
for (const action of this._submenu.actions) {
|
|
82
|
+
if (action instanceof SubmenuAction) {
|
|
83
|
+
groups.push(action.actions);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
groups.push([action]);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
for (let i = 0; i < groups.length; i++) {
|
|
90
|
+
const group = groups[i];
|
|
91
|
+
const toolbar = this._instaService.createInstance(WorkbenchToolBar, container, {
|
|
92
|
+
hiddenItemStrategy: -1 ,
|
|
93
|
+
telemetrySource: 'commandCenterCenter',
|
|
94
|
+
actionViewItemProvider: (action, options) => {
|
|
95
|
+
options = {
|
|
96
|
+
...options,
|
|
97
|
+
hoverDelegate: this._hoverDelegate,
|
|
98
|
+
};
|
|
99
|
+
if (action.id !== CommandCenterCenterViewItem_1._quickOpenCommandId) {
|
|
100
|
+
return createActionViewItem(this._instaService, action, options);
|
|
101
|
+
}
|
|
102
|
+
const that = this;
|
|
103
|
+
return this._instaService.createInstance(class CommandCenterQuickPickItem extends BaseActionViewItem {
|
|
104
|
+
constructor() {
|
|
105
|
+
super(undefined, action, options);
|
|
106
|
+
}
|
|
107
|
+
render(container) {
|
|
108
|
+
super.render(container);
|
|
109
|
+
container.classList.toggle('command-center-quick-pick');
|
|
110
|
+
const action = this.action;
|
|
111
|
+
const searchIcon = document.createElement('span');
|
|
112
|
+
searchIcon.ariaHidden = 'true';
|
|
113
|
+
searchIcon.className = action.class ?? '';
|
|
114
|
+
searchIcon.classList.add('search-icon');
|
|
115
|
+
const label = this._getLabel();
|
|
116
|
+
const labelElement = document.createElement('span');
|
|
117
|
+
labelElement.classList.add('search-label');
|
|
118
|
+
labelElement.innerText = label;
|
|
119
|
+
reset(container, searchIcon, labelElement);
|
|
120
|
+
const hover = this._store.add(setupCustomHover(that._hoverDelegate, container, this.getTooltip()));
|
|
121
|
+
this._store.add(that._windowTitle.onDidChange(() => {
|
|
122
|
+
hover.update(this.getTooltip());
|
|
123
|
+
labelElement.innerText = this._getLabel();
|
|
124
|
+
}));
|
|
125
|
+
this._store.add(that._editorGroupService.onDidChangeEditorPartOptions(({ newPartOptions, oldPartOptions }) => {
|
|
126
|
+
if (newPartOptions.showTabs !== oldPartOptions.showTabs) {
|
|
127
|
+
hover.update(this.getTooltip());
|
|
128
|
+
labelElement.innerText = this._getLabel();
|
|
129
|
+
}
|
|
130
|
+
}));
|
|
131
|
+
}
|
|
132
|
+
getTooltip() {
|
|
133
|
+
return that.getTooltip();
|
|
134
|
+
}
|
|
135
|
+
_getLabel() {
|
|
136
|
+
const { prefix, suffix } = that._windowTitle.getTitleDecorations();
|
|
137
|
+
let label = that._windowTitle.workspaceName;
|
|
138
|
+
if (that._windowTitle.isCustomTitleFormat()) {
|
|
139
|
+
label = that._windowTitle.getWindowTitle();
|
|
140
|
+
}
|
|
141
|
+
else if (that._editorGroupService.partOptions.showTabs === 'none') {
|
|
142
|
+
label = that._windowTitle.fileName ?? label;
|
|
143
|
+
}
|
|
144
|
+
if (!label) {
|
|
145
|
+
label = ( localizeWithPath(
|
|
146
|
+
'vs/workbench/browser/parts/titlebar/commandCenterControl',
|
|
147
|
+
'label.dfl',
|
|
148
|
+
"Search"
|
|
149
|
+
));
|
|
150
|
+
}
|
|
151
|
+
if (prefix) {
|
|
152
|
+
label = ( localizeWithPath(
|
|
153
|
+
'vs/workbench/browser/parts/titlebar/commandCenterControl',
|
|
154
|
+
'label1',
|
|
155
|
+
"{0} {1}",
|
|
156
|
+
prefix,
|
|
157
|
+
label
|
|
158
|
+
));
|
|
159
|
+
}
|
|
160
|
+
if (suffix) {
|
|
161
|
+
label = ( localizeWithPath(
|
|
162
|
+
'vs/workbench/browser/parts/titlebar/commandCenterControl',
|
|
163
|
+
'label2',
|
|
164
|
+
"{0} {1}",
|
|
165
|
+
label,
|
|
166
|
+
suffix
|
|
167
|
+
));
|
|
168
|
+
}
|
|
169
|
+
return label.replaceAll(/\r\n|\r|\n/g, '\u23CE');
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
toolbar.setActions(group);
|
|
175
|
+
this._store.add(toolbar);
|
|
176
|
+
if (i < groups.length - 1) {
|
|
177
|
+
const icon = renderIcon(Codicon.circleSmallFilled);
|
|
178
|
+
icon.style.padding = '0 12px';
|
|
179
|
+
icon.style.height = '100%';
|
|
180
|
+
icon.style.opacity = '0.5';
|
|
181
|
+
container.appendChild(icon);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
getTooltip() {
|
|
186
|
+
const kb = this._keybindingService.lookupKeybinding(this.action.id)?.getLabel();
|
|
187
|
+
const title = kb
|
|
188
|
+
? ( localizeWithPath(
|
|
189
|
+
'vs/workbench/browser/parts/titlebar/commandCenterControl',
|
|
190
|
+
'title',
|
|
191
|
+
"Search {0} ({1}) \u2014 {2}",
|
|
192
|
+
this._windowTitle.workspaceName,
|
|
193
|
+
kb,
|
|
194
|
+
this._windowTitle.value
|
|
195
|
+
))
|
|
196
|
+
: ( localizeWithPath(
|
|
197
|
+
'vs/workbench/browser/parts/titlebar/commandCenterControl',
|
|
198
|
+
'title2',
|
|
199
|
+
"Search {0} \u2014 {1}",
|
|
200
|
+
this._windowTitle.workspaceName,
|
|
201
|
+
this._windowTitle.value
|
|
202
|
+
));
|
|
203
|
+
return title;
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
CommandCenterCenterViewItem = CommandCenterCenterViewItem_1 = ( __decorate([
|
|
207
|
+
( __param(3, IKeybindingService)),
|
|
208
|
+
( __param(4, IInstantiationService)),
|
|
209
|
+
( __param(5, IEditorGroupsService))
|
|
210
|
+
], CommandCenterCenterViewItem));
|
|
211
|
+
MenuRegistry.appendMenuItem(MenuId.CommandCenter, {
|
|
212
|
+
submenu: MenuId.CommandCenterCenter,
|
|
213
|
+
title: ( localizeWithPath(
|
|
214
|
+
'vs/workbench/browser/parts/titlebar/commandCenterControl',
|
|
215
|
+
'title3',
|
|
216
|
+
"Command Center"
|
|
217
|
+
)),
|
|
218
|
+
icon: Codicon.shield,
|
|
219
|
+
order: 101,
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
export { CommandCenterControl };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import n from '../../../../../../../../external/rollup-plugin-styles/dist/runtime/inject-css.js';
|
|
2
|
+
|
|
3
|
+
var css = ".monaco-workbench .part.titlebar{display:flex;flex-direction:row}.monaco-workbench.mac .part.titlebar{flex-direction:row-reverse}.monaco-workbench .part.titlebar>.titlebar-container{align-items:center;box-sizing:border-box;display:flex;flex-grow:1;flex-shrink:1;height:100%;justify-content:space-between;overflow:hidden;user-select:none;-webkit-user-select:none;width:100%}.monaco-workbench .part.titlebar>.titlebar-container.counter-zoom{zoom:calc(1/var(--zoom-factor))}.monaco-workbench.mac .part.titlebar>.titlebar-container{line-height:22px}.monaco-workbench.linux .part.titlebar>.titlebar-container,.monaco-workbench.web .part.titlebar>.titlebar-container,.monaco-workbench.windows .part.titlebar>.titlebar-container{justify-content:left;line-height:22px}.monaco-workbench.web.safari .part.titlebar,.monaco-workbench.web.safari .part.titlebar>.titlebar-container{overflow:visible}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-drag-region{-webkit-app-region:drag;display:block;height:100%;left:0;position:absolute;top:0;width:100%}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-center,.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-left,.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-right{align-items:center;display:flex;height:100%}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-left{flex-grow:2;justify-content:flex-start;order:0;width:20%}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-center{justify-content:center;margin:0 10px;max-width:fit-content;min-width:0;order:1;width:60%}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-right{flex-grow:2;justify-content:flex-end;min-width:min-content;order:2;width:20%}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-center>.window-title{flex:0 1 auto;font-size:12px;margin-left:auto;margin-right:auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.monaco-workbench.linux .part.titlebar>.titlebar-container>.titlebar-center>.window-title,.monaco-workbench.web .part.titlebar>.titlebar-container>.titlebar-center>.window-title,.monaco-workbench.windows .part.titlebar>.titlebar-container>.titlebar-center>.window-title{cursor:default}.monaco-workbench.linux .part.titlebar>.titlebar-container>.titlebar-center>.window-title{font-size:inherit}.monaco-workbench .part.titlebar>.titlebar-container .monaco-toolbar .actions-container{gap:4px}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-center>.window-title>.command-center{-webkit-app-region:no-drag;z-index:2500}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-center>.window-title>.command-center.hide{visibility:hidden}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-center>.window-title>.command-center>.monaco-toolbar>.monaco-action-bar>.actions-container>.action-item>.action-label{color:var(--vscode-titleBar-activeForeground)}.monaco-workbench .part.titlebar.inactive>.titlebar-container>.titlebar-center>.window-title>.command-center>.monaco-toolbar>.monaco-action-bar>.actions-container>.action-item>.action-label{color:var(--vscode-titleBar-inactiveForeground)}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-center>.window-title>.command-center>.monaco-toolbar>.monaco-action-bar>.actions-container>.action-item>.action-label{color:inherit}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-center>.window-title>.command-center .action-item.command-center-center{align-items:stretch;background-color:var(--vscode-commandCenter-background);border:1px solid var(--vscode-commandCenter-border);border-bottom-left-radius:6px;border-bottom-right-radius:6px;border-top-left-radius:6px;border-top-right-radius:6px;color:var(--vscode-commandCenter-foreground);display:flex;height:22px;margin-left:6px;max-width:600px;overflow:hidden;width:38vw}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-center>.window-title>.command-center .action-item.command-center-center .action-item.command-center-quick-pick{display:flex;justify-content:start;margin:auto;max-width:600px;overflow:hidden}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-center>.window-title>.command-center .action-item.command-center-center .action-item.command-center-quick-pick .search-icon{font-size:14px;margin:auto 3px;opacity:.8}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-center>.window-title>.command-center .action-item.command-center-center .action-item.command-center-quick-pick .search-label{overflow:hidden;text-overflow:ellipsis}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-center>.window-title>.command-center .action-item.command-center-center.multiple{justify-content:flex-start;padding:0 12px}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-center>.window-title>.command-center .action-item.command-center-center.multiple.active .action-label{background-color:inherit}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-center>.window-title>.command-center .action-item.command-center-center:only-child{margin-left:0}.monaco-workbench .part.titlebar.inactive>.titlebar-container>.titlebar-center>.window-title>.command-center .action-item.command-center-center{border-color:var(--vscode-commandCenter-inactiveBorder)!important;color:var(--vscode-titleBar-inactiveForeground)}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-center>.window-title>.command-center .action-item.command-center-center:HOVER{background-color:var(--vscode-commandCenter-activeBackground);border-color:var(--vscode-commandCenter-activeBorder);color:var(--vscode-commandCenter-activeForeground)}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-left>.menubar{flex-wrap:nowrap;min-width:36px;order:2;z-index:2500}.monaco-workbench.web .part.titlebar>.titlebar-container>.titlebar-left>.menubar{margin-left:4px}.monaco-workbench .part.titlebar>.titlebar-container.counter-zoom .menubar .menubar-menu-button>.menubar-menu-items-holder.monaco-menu-container{zoom:var(--zoom-factor)}.monaco-workbench.linux .part.titlebar>.titlebar-container>.resizer,.monaco-workbench.windows .part.titlebar>.titlebar-container>.resizer{-webkit-app-region:no-drag;height:4px;position:absolute;top:0;width:100%}.monaco-workbench.linux.fullscreen .part.titlebar>.titlebar-container>.resizer,.monaco-workbench.windows.fullscreen .part.titlebar>.titlebar-container>.resizer{display:none}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-left>.window-appicon{flex-shrink:0;height:100%;order:1;position:relative;width:35px;z-index:2500}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-left>.window-appicon:not(.codicon){background-image:url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiPjxwYXRoIGQ9Ik0xMDI0IDEwMjRIMFYwaDEwMjR2MTAyNHoiIHN0eWxlPSJmaWxsOiNmNmY2ZjY7ZmlsbC1vcGFjaXR5OjAiIGZpbGw9Im5vbmUiLz48cGF0aCBkPSJNMTAyNCA4NS4zMzN2ODUzLjMzM0gwVjg1LjMzM2gxMDI0eiIgc3R5bGU9ImZpbGw6I2ZmZiIvPjxwYXRoIGQ9Ik0wIDg1LjMzM2gyOTguNjY3djg1My4zMzNIMFY4NS4zMzN6bTEwMjQgMHY4NTMuMzMzSDM4NFY4NS4zMzNoNjQwem0tNTU0LjY2NyAxNjBoMzQxLjMzM3YtNjRINDY5LjMzM3Y2NHptMzQxLjMzNCA1MzMuMzM0SDQ2OS4zMzN2NjRoMzQxLjMzM2wuMDAxLTY0em0xMjgtMTQ5LjMzNEg1OTcuMzMzdjY0aDM0MS4zMzNsLjAwMS02NHptMC0xNDkuMzMzSDU5Ny4zMzN2NjRoMzQxLjMzM2wuMDAxLTY0em0wLTE0OS4zMzNINTk3LjMzM3Y2NGgzNDEuMzMzbC4wMDEtNjR6IiBzdHlsZT0iZmlsbDojMTY3YWJmIi8+PC9zdmc+\");background-position:50%;background-repeat:no-repeat;background-size:16px}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-left>.window-appicon.codicon{line-height:30px}.monaco-workbench.fullscreen .part.titlebar>.titlebar-container>.titlebar-left>.window-appicon{display:none}.monaco-workbench .part.titlebar>.titlebar-container .window-appicon>.home-bar-icon-badge{background-image:url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiPjxwYXRoIGQ9Ik0xMDI0IDEwMjRIMFYwaDEwMjR2MTAyNHoiIHN0eWxlPSJmaWxsOiNmNmY2ZjY7ZmlsbC1vcGFjaXR5OjAiIGZpbGw9Im5vbmUiLz48cGF0aCBkPSJNMTAyNCA4NS4zMzN2ODUzLjMzM0gwVjg1LjMzM2gxMDI0eiIgc3R5bGU9ImZpbGw6I2ZmZiIvPjxwYXRoIGQ9Ik0wIDg1LjMzM2gyOTguNjY3djg1My4zMzNIMFY4NS4zMzN6bTEwMjQgMHY4NTMuMzMzSDM4NFY4NS4zMzNoNjQwem0tNTU0LjY2NyAxNjBoMzQxLjMzM3YtNjRINDY5LjMzM3Y2NHptMzQxLjMzNCA1MzMuMzM0SDQ2OS4zMzN2NjRoMzQxLjMzM2wuMDAxLTY0em0xMjgtMTQ5LjMzNEg1OTcuMzMzdjY0aDM0MS4zMzNsLjAwMS02NHptMC0xNDkuMzMzSDU5Ny4zMzN2NjRoMzQxLjMzM2wuMDAxLTY0em0wLTE0OS4zMzNINTk3LjMzM3Y2NGgzNDEuMzMzbC4wMDEtNjR6IiBzdHlsZT0iZmlsbDojMTY3YWJmIi8+PC9zdmc+\");background-position:50%;background-repeat:no-repeat;background-size:8px;border-left:1px solid transparent;border-top:1px solid transparent;bottom:6px;height:8px;pointer-events:none;position:absolute;right:9px;width:8px;z-index:1}.monaco-workbench .part.titlebar .window-controls-container{-webkit-app-region:no-drag;display:flex;flex-grow:0;flex-shrink:0;height:100%;text-align:center;width:0;z-index:3000}.monaco-workbench.web .part.titlebar .titlebar-right .window-controls-container{height:env(titlebar-area-height,35px);width:calc(100vw - env(titlebar-area-width, 100vw) - env(titlebar-area-x, 0px))}.monaco-workbench.web .part.titlebar .titlebar-left .window-controls-container{height:env(titlebar-area-height,35px);width:env(titlebar-area-x,0)}.monaco-workbench.web.mac .part.titlebar .titlebar-left .window-controls-container{order:0}.monaco-workbench.web.mac .part.titlebar .titlebar-right .window-controls-container{order:1}.monaco-workbench:not(.web):not(.mac) .part.titlebar .window-controls-container.primary{width:calc(138px/var(--zoom-factor, 1))}.monaco-workbench:not(.web):not(.mac) .part.titlebar .titlebar-container.counter-zoom .window-controls-container.primary{width:138px}.monaco-workbench:not(.web):not(.mac) .part.titlebar .titlebar-container:not(.counter-zoom) .window-controls-container *{zoom:calc(1/var(--zoom-factor, 1))}.monaco-workbench:not(.web).mac .part.titlebar .window-controls-container.primary{width:70px}.monaco-workbench.fullscreen .part.titlebar .window-controls-container{background-color:transparent;display:none}.monaco-workbench .part.titlebar .window-controls-container>.window-icon{align-items:center;display:flex;font-size:16px;height:100%;justify-content:center;width:46px}.monaco-workbench .part.titlebar .window-controls-container>.window-icon:before{height:16px;line-height:16px}.monaco-workbench .part.titlebar .window-controls-container>.window-icon:hover{background-color:hsla(0,0%,100%,.1)}.monaco-workbench .part.titlebar.light .window-controls-container>.window-icon:hover{background-color:rgba(0,0,0,.1)}.monaco-workbench .part.titlebar .window-controls-container>.window-icon.window-close:hover{background-color:rgba(232,17,35,.9)}.monaco-workbench .part.titlebar .window-controls-container .window-icon.window-close:hover{color:#fff}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-right>.action-toolbar-container{-webkit-app-region:no-drag;display:none;flex-grow:0;flex-shrink:0;height:100%;margin-left:auto;min-width:28px;padding-right:2px;position:relative;text-align:center;z-index:2500}.monaco-workbench.mac:not(.web) .part.titlebar>.titlebar-container>.titlebar-right>.action-toolbar-container{right:8px}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-right>.action-toolbar-container:not(.has-no-actions){display:flex;justify-content:center}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-right>.action-toolbar-container .codicon{color:inherit}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-right>.action-toolbar-container .monaco-action-bar .action-item{display:flex}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-right>.action-toolbar-container .monaco-action-bar .badge{align-items:center;display:flex;margin-left:8px}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-right>.action-toolbar-container .monaco-action-bar .action-item.icon .badge{margin-left:0}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-right>.action-toolbar-container .monaco-action-bar .badge .badge-content{border-radius:11px;box-sizing:border-box;display:inline-block;font-size:9px;font-weight:400;height:16px;line-height:11px;min-width:11px;padding:3px 5px;position:relative;text-align:center}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-right>.action-toolbar-container .monaco-action-bar .action-item.icon .badge.compact{bottom:0;height:100%;left:0;margin:auto;overflow:hidden;position:absolute;top:0;width:100%;z-index:2}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-right>.action-toolbar-container .monaco-action-bar .action-item.icon .badge.compact .badge-content:before{mask-size:12px;-webkit-mask-size:12px;top:2px}.monaco-workbench .part.titlebar>.titlebar-container>.titlebar-right>.action-toolbar-container .monaco-action-bar .action-item.icon .badge.compact .badge-content{border-radius:16px;font-size:9px;font-weight:600;height:12px;line-height:12px;min-width:12px;padding:0 2px;position:absolute;right:0;text-align:center;top:10px}.monaco-workbench .part.titlebar .window-controls-container .window-icon{color:var(--vscode-titleBar-activeForeground)}.monaco-workbench .part.titlebar.inactive .window-controls-container .window-icon{color:var(--vscode-titleBar-inactiveForeground)}";
|
|
4
|
+
n(css,{});
|
|
5
|
+
|
|
6
|
+
export { css, css as default };
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { localizeWithPath, localize2WithPath } from 'vscode/vscode/vs/nls';
|
|
2
|
+
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
3
|
+
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
4
|
+
import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
5
|
+
import { ContextKeyExpr, IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
6
|
+
import { ACCOUNTS_ACTIVITY_ID, GLOBAL_ACTIVITY_ID } from 'vscode/vscode/vs/workbench/common/activity';
|
|
7
|
+
import { TitleBarStyleContext, IsMainWindowFullscreenContext, TitleBarVisibleContext, IsAuxiliaryWindowFocusedContext } from 'vscode/vscode/vs/workbench/common/contextkeys';
|
|
8
|
+
|
|
9
|
+
class ToggleConfigAction extends Action2 {
|
|
10
|
+
constructor(section, title, order, mainWindowOnly) {
|
|
11
|
+
const when = mainWindowOnly ? ( IsAuxiliaryWindowFocusedContext.toNegated()) : ContextKeyExpr.true();
|
|
12
|
+
super({
|
|
13
|
+
id: `toggle.${section}`,
|
|
14
|
+
title,
|
|
15
|
+
toggled: ( ContextKeyExpr.equals(`config.${section}`, true)),
|
|
16
|
+
menu: [
|
|
17
|
+
{
|
|
18
|
+
id: MenuId.TitleBarContext,
|
|
19
|
+
when,
|
|
20
|
+
order,
|
|
21
|
+
group: '2_config'
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: MenuId.TitleBarTitleContext,
|
|
25
|
+
when,
|
|
26
|
+
order,
|
|
27
|
+
group: '2_config'
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
});
|
|
31
|
+
this.section = section;
|
|
32
|
+
}
|
|
33
|
+
run(accessor, ...args) {
|
|
34
|
+
const configService = accessor.get(IConfigurationService);
|
|
35
|
+
const value = configService.getValue(this.section);
|
|
36
|
+
configService.updateValue(this.section, !value);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
registerAction2(class ToggleCommandCenter extends ToggleConfigAction {
|
|
40
|
+
constructor() {
|
|
41
|
+
super("window.commandCenter" , ( localizeWithPath(
|
|
42
|
+
'vs/workbench/browser/parts/titlebar/titlebarActions',
|
|
43
|
+
'toggle.commandCenter',
|
|
44
|
+
'Command Center'
|
|
45
|
+
)), 1, false);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
registerAction2(class ToggleLayoutControl extends ToggleConfigAction {
|
|
49
|
+
constructor() {
|
|
50
|
+
super('workbench.layoutControl.enabled', ( localizeWithPath(
|
|
51
|
+
'vs/workbench/browser/parts/titlebar/titlebarActions',
|
|
52
|
+
'toggle.layout',
|
|
53
|
+
'Layout Controls'
|
|
54
|
+
)), 2, true);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
registerAction2(class ToggleCustomTitleBar extends Action2 {
|
|
58
|
+
constructor() {
|
|
59
|
+
super({
|
|
60
|
+
id: `toggle.${"window.customTitleBarVisibility" }`,
|
|
61
|
+
title: ( localizeWithPath(
|
|
62
|
+
'vs/workbench/browser/parts/titlebar/titlebarActions',
|
|
63
|
+
'toggle.hideCustomTitleBar',
|
|
64
|
+
'Hide Custom Title Bar'
|
|
65
|
+
)),
|
|
66
|
+
menu: [
|
|
67
|
+
{ id: MenuId.TitleBarContext, order: 0, when: ( ContextKeyExpr.equals(TitleBarStyleContext.key, "native" )), group: '3_toggle' },
|
|
68
|
+
{ id: MenuId.TitleBarTitleContext, order: 0, when: ( ContextKeyExpr.equals(TitleBarStyleContext.key, "native" )), group: '3_toggle' },
|
|
69
|
+
]
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
run(accessor, ...args) {
|
|
73
|
+
const configService = accessor.get(IConfigurationService);
|
|
74
|
+
configService.updateValue("window.customTitleBarVisibility" , "never" );
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
registerAction2(class ToggleCustomTitleBarWindowed extends Action2 {
|
|
78
|
+
constructor() {
|
|
79
|
+
super({
|
|
80
|
+
id: `toggle.${"window.customTitleBarVisibility" }.windowed`,
|
|
81
|
+
title: ( localizeWithPath(
|
|
82
|
+
'vs/workbench/browser/parts/titlebar/titlebarActions',
|
|
83
|
+
'toggle.hideCustomTitleBarInFullScreen',
|
|
84
|
+
'Hide Custom Title Bar In Full Screen'
|
|
85
|
+
)),
|
|
86
|
+
menu: [
|
|
87
|
+
{ id: MenuId.TitleBarContext, order: 1, when: IsMainWindowFullscreenContext, group: '3_toggle' },
|
|
88
|
+
{ id: MenuId.TitleBarTitleContext, order: 1, when: IsMainWindowFullscreenContext, group: '3_toggle' },
|
|
89
|
+
]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
run(accessor, ...args) {
|
|
93
|
+
const configService = accessor.get(IConfigurationService);
|
|
94
|
+
configService.updateValue("window.customTitleBarVisibility" , "windowed" );
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
class ToggleCustomTitleBar extends Action2 {
|
|
98
|
+
constructor() {
|
|
99
|
+
super({
|
|
100
|
+
id: `toggle.toggleCustomTitleBar`,
|
|
101
|
+
title: ( localizeWithPath(
|
|
102
|
+
'vs/workbench/browser/parts/titlebar/titlebarActions',
|
|
103
|
+
'toggle.customTitleBar',
|
|
104
|
+
'Custom Title Bar'
|
|
105
|
+
)),
|
|
106
|
+
toggled: TitleBarVisibleContext,
|
|
107
|
+
menu: [
|
|
108
|
+
{
|
|
109
|
+
id: MenuId.MenubarAppearanceMenu,
|
|
110
|
+
order: 6,
|
|
111
|
+
when: ( ContextKeyExpr.or(( ContextKeyExpr.and(( ContextKeyExpr.equals(TitleBarStyleContext.key, "native" )), ( ContextKeyExpr.and(( ContextKeyExpr.equals('config.workbench.layoutControl.enabled', false)), ( ContextKeyExpr.equals('config.window.commandCenter', false)), ( ContextKeyExpr.notEquals('config.workbench.editor.editorActionsLocation', 'titleBar')), ( ContextKeyExpr.notEquals('config.workbench.activityBar.location', 'top')), ( ContextKeyExpr.notEquals('config.workbench.activityBar.location', 'bottom'))))?.negate())), IsMainWindowFullscreenContext)),
|
|
112
|
+
group: '2_workbench_layout'
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
run(accessor, ...args) {
|
|
118
|
+
const configService = accessor.get(IConfigurationService);
|
|
119
|
+
const contextKeyService = accessor.get(IContextKeyService);
|
|
120
|
+
const titleBarVisibility = configService.getValue("window.customTitleBarVisibility" );
|
|
121
|
+
switch (titleBarVisibility) {
|
|
122
|
+
case "never" :
|
|
123
|
+
configService.updateValue("window.customTitleBarVisibility" , "auto" );
|
|
124
|
+
break;
|
|
125
|
+
case "windowed" : {
|
|
126
|
+
const isFullScreen = IsMainWindowFullscreenContext.evaluate(contextKeyService.getContext(null));
|
|
127
|
+
if (isFullScreen) {
|
|
128
|
+
configService.updateValue("window.customTitleBarVisibility" , "auto" );
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
configService.updateValue("window.customTitleBarVisibility" , "never" );
|
|
132
|
+
}
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
case "auto" :
|
|
136
|
+
default:
|
|
137
|
+
configService.updateValue("window.customTitleBarVisibility" , "never" );
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
registerAction2(ToggleCustomTitleBar);
|
|
143
|
+
registerAction2(class ShowCustomTitleBar extends Action2 {
|
|
144
|
+
constructor() {
|
|
145
|
+
super({
|
|
146
|
+
id: `showCustomTitleBar`,
|
|
147
|
+
title: ( localize2WithPath(
|
|
148
|
+
'vs/workbench/browser/parts/titlebar/titlebarActions',
|
|
149
|
+
'showCustomTitleBar',
|
|
150
|
+
"Show Custom Title Bar"
|
|
151
|
+
)),
|
|
152
|
+
precondition: ( TitleBarVisibleContext.negate()),
|
|
153
|
+
f1: true
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
run(accessor, ...args) {
|
|
157
|
+
const configService = accessor.get(IConfigurationService);
|
|
158
|
+
configService.updateValue("window.customTitleBarVisibility" , "auto" );
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
registerAction2(class HideCustomTitleBar extends Action2 {
|
|
162
|
+
constructor() {
|
|
163
|
+
super({
|
|
164
|
+
id: `hideCustomTitleBar`,
|
|
165
|
+
title: ( localize2WithPath(
|
|
166
|
+
'vs/workbench/browser/parts/titlebar/titlebarActions',
|
|
167
|
+
'hideCustomTitleBar',
|
|
168
|
+
"Hide Custom Title Bar"
|
|
169
|
+
)),
|
|
170
|
+
precondition: TitleBarVisibleContext,
|
|
171
|
+
f1: true
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
run(accessor, ...args) {
|
|
175
|
+
const configService = accessor.get(IConfigurationService);
|
|
176
|
+
configService.updateValue("window.customTitleBarVisibility" , "never" );
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
registerAction2(class HideCustomTitleBar extends Action2 {
|
|
180
|
+
constructor() {
|
|
181
|
+
super({
|
|
182
|
+
id: `hideCustomTitleBarInFullScreen`,
|
|
183
|
+
title: ( localize2WithPath(
|
|
184
|
+
'vs/workbench/browser/parts/titlebar/titlebarActions',
|
|
185
|
+
'hideCustomTitleBarInFullScreen',
|
|
186
|
+
"Hide Custom Title Bar In Full Screen"
|
|
187
|
+
)),
|
|
188
|
+
precondition: ( ContextKeyExpr.and(TitleBarVisibleContext, IsMainWindowFullscreenContext)),
|
|
189
|
+
f1: true
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
run(accessor, ...args) {
|
|
193
|
+
const configService = accessor.get(IConfigurationService);
|
|
194
|
+
configService.updateValue("window.customTitleBarVisibility" , "windowed" );
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
registerAction2(class ToggleEditorActions extends Action2 {
|
|
198
|
+
static { this.settingsID = `workbench.editor.editorActionsLocation`; }
|
|
199
|
+
constructor() {
|
|
200
|
+
const titleBarContextCondition = ( ContextKeyExpr.and(( ( ContextKeyExpr.equals(`config.workbench.editor.showTabs`, 'none')).negate()), ( ContextKeyExpr.equals(`config.${ToggleEditorActions.settingsID}`, 'default'))))?.negate();
|
|
201
|
+
super({
|
|
202
|
+
id: `toggle.${ToggleEditorActions.settingsID}`,
|
|
203
|
+
title: ( localizeWithPath(
|
|
204
|
+
'vs/workbench/browser/parts/titlebar/titlebarActions',
|
|
205
|
+
'toggle.editorActions',
|
|
206
|
+
'Editor Actions'
|
|
207
|
+
)),
|
|
208
|
+
toggled: ( ( ContextKeyExpr.equals(`config.${ToggleEditorActions.settingsID}`, 'hidden')).negate()),
|
|
209
|
+
menu: [
|
|
210
|
+
{ id: MenuId.TitleBarContext, order: 3, when: titleBarContextCondition, group: '2_config' },
|
|
211
|
+
{ id: MenuId.TitleBarTitleContext, order: 3, when: titleBarContextCondition, group: '2_config' }
|
|
212
|
+
]
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
run(accessor, ...args) {
|
|
216
|
+
const configService = accessor.get(IConfigurationService);
|
|
217
|
+
const storageService = accessor.get(IStorageService);
|
|
218
|
+
const location = configService.getValue(ToggleEditorActions.settingsID);
|
|
219
|
+
if (location === 'hidden') {
|
|
220
|
+
const showTabs = configService.getValue("workbench.editor.showTabs" );
|
|
221
|
+
if (showTabs !== 'none') {
|
|
222
|
+
configService.updateValue(ToggleEditorActions.settingsID, 'titleBar');
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
const storedValue = storageService.get(ToggleEditorActions.settingsID, 0 );
|
|
226
|
+
configService.updateValue(ToggleEditorActions.settingsID, storedValue ?? 'default');
|
|
227
|
+
}
|
|
228
|
+
storageService.remove(ToggleEditorActions.settingsID, 0 );
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
configService.updateValue(ToggleEditorActions.settingsID, 'hidden');
|
|
232
|
+
storageService.store(ToggleEditorActions.settingsID, location, 0 , 0 );
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
const ACCOUNTS_ACTIVITY_TILE_ACTION = {
|
|
237
|
+
id: ACCOUNTS_ACTIVITY_ID,
|
|
238
|
+
label: ( localizeWithPath(
|
|
239
|
+
'vs/workbench/browser/parts/titlebar/titlebarActions',
|
|
240
|
+
'accounts',
|
|
241
|
+
"Accounts"
|
|
242
|
+
)),
|
|
243
|
+
tooltip: ( localizeWithPath(
|
|
244
|
+
'vs/workbench/browser/parts/titlebar/titlebarActions',
|
|
245
|
+
'accounts',
|
|
246
|
+
"Accounts"
|
|
247
|
+
)),
|
|
248
|
+
class: undefined,
|
|
249
|
+
enabled: true,
|
|
250
|
+
run: function () { }
|
|
251
|
+
};
|
|
252
|
+
const GLOBAL_ACTIVITY_TITLE_ACTION = {
|
|
253
|
+
id: GLOBAL_ACTIVITY_ID,
|
|
254
|
+
label: ( localizeWithPath('vs/workbench/browser/parts/titlebar/titlebarActions', 'manage', "Manage")),
|
|
255
|
+
tooltip: ( localizeWithPath('vs/workbench/browser/parts/titlebar/titlebarActions', 'manage', "Manage")),
|
|
256
|
+
class: undefined,
|
|
257
|
+
enabled: true,
|
|
258
|
+
run: function () { }
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
export { ACCOUNTS_ACTIVITY_TILE_ACTION, GLOBAL_ACTIVITY_TITLE_ACTION };
|
|
@@ -0,0 +1,584 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import './media/titlebarpart.css.js';
|
|
3
|
+
import { localizeWithPath, localize2WithPath } from 'vscode/vscode/vs/nls';
|
|
4
|
+
import { Part, MultiWindowParts } from 'vscode/vscode/vs/workbench/browser/part';
|
|
5
|
+
import { getZoomFactor, isWCOEnabled } from 'vscode/vscode/vs/base/browser/browser';
|
|
6
|
+
import { getTitleBarStyle, hasNativeTitlebar, getMenuBarVisibility } from 'vscode/vscode/vs/platform/window/common/window';
|
|
7
|
+
import { IContextMenuService } from 'vscode/vscode/vs/platform/contextview/browser/contextView';
|
|
8
|
+
import { StandardMouseEvent } from 'vscode/vscode/vs/base/browser/mouseEvent';
|
|
9
|
+
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
10
|
+
import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
11
|
+
import { IBrowserWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/browser/environmentService';
|
|
12
|
+
import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
|
|
13
|
+
import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
|
|
14
|
+
import { TITLE_BAR_INACTIVE_BACKGROUND, TITLE_BAR_ACTIVE_BACKGROUND, WORKBENCH_BACKGROUND, TITLE_BAR_INACTIVE_FOREGROUND, TITLE_BAR_ACTIVE_FOREGROUND, TITLE_BAR_BORDER } from 'vscode/vscode/vs/workbench/common/theme';
|
|
15
|
+
import { isWeb, isMacintosh, isWindows, isLinux, isNative, platformLocale } from 'vscode/vscode/vs/base/common/platform';
|
|
16
|
+
import { Color } from 'vscode/vscode/vs/base/common/color';
|
|
17
|
+
import { getWindow, getWindowId, append, $, prepend, addDisposableListener, EventType, EventHelper, isAncestor, reset, Dimension, getActiveDocument } from 'vscode/vscode/vs/base/browser/dom';
|
|
18
|
+
import { CustomMenubarControl } from 'vscode/vscode/vs/workbench/browser/parts/titlebar/menubarControl';
|
|
19
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
20
|
+
import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
|
|
21
|
+
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
22
|
+
import { IWorkbenchLayoutService } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService';
|
|
23
|
+
import { createActionViewItem, createAndFillInActionBarActions } from 'vscode/vscode/vs/platform/actions/browser/menuEntryActionViewItem';
|
|
24
|
+
import { MenuId, registerAction2, Action2, IMenuService } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
25
|
+
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
26
|
+
import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host';
|
|
27
|
+
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
28
|
+
import { getIconRegistry } from 'vscode/vscode/vs/platform/theme/common/iconRegistry';
|
|
29
|
+
import { WindowTitle } from 'vscode/vscode/vs/workbench/browser/parts/titlebar/windowTitle';
|
|
30
|
+
import { CommandCenterControl } from './commandCenterControl.js';
|
|
31
|
+
import { Categories } from 'vscode/vscode/vs/platform/action/common/actionCommonCategories';
|
|
32
|
+
import { WorkbenchToolBar } from 'vscode/vscode/vs/platform/actions/browser/toolbar';
|
|
33
|
+
import { GLOBAL_ACTIVITY_ID, ACCOUNTS_ACTIVITY_ID } from 'vscode/vscode/vs/workbench/common/activity';
|
|
34
|
+
import { SimpleGlobalActivityActionViewItem, SimpleAccountActivityActionViewItem } from 'vscode/vscode/vs/workbench/browser/parts/globalCompositeBar';
|
|
35
|
+
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
|
|
36
|
+
import { ActionRunner } from 'vscode/vscode/vs/base/common/actions';
|
|
37
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
38
|
+
import { prepareActions } from 'vscode/vscode/vs/base/browser/ui/actionbar/actionbar';
|
|
39
|
+
import { EDITOR_CORE_NAVIGATION_COMMANDS } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorCommands';
|
|
40
|
+
import { EditorPane } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorPane';
|
|
41
|
+
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
|
|
42
|
+
import { EditorCommandsContextActionRunner } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorTabsControl';
|
|
43
|
+
import { mainWindow } from 'vscode/vscode/vs/base/browser/window';
|
|
44
|
+
import { ACCOUNTS_ACTIVITY_TILE_ACTION, GLOBAL_ACTIVITY_TITLE_ACTION } from './titlebarActions.js';
|
|
45
|
+
import { createInstantHoverDelegate } from 'vscode/vscode/vs/base/browser/ui/hover/hoverDelegateFactory';
|
|
46
|
+
|
|
47
|
+
var AuxiliaryBrowserTitlebarPart_1;
|
|
48
|
+
let BrowserTitleService = class BrowserTitleService extends MultiWindowParts {
|
|
49
|
+
constructor(instantiationService, storageService, themeService) {
|
|
50
|
+
super('workbench.titleService', themeService, storageService);
|
|
51
|
+
this.instantiationService = instantiationService;
|
|
52
|
+
this.mainPart = this._register(this.createMainTitlebarPart());
|
|
53
|
+
this.onMenubarVisibilityChange = this.mainPart.onMenubarVisibilityChange;
|
|
54
|
+
this.properties = undefined;
|
|
55
|
+
this.variables = [];
|
|
56
|
+
this._register(this.registerPart(this.mainPart));
|
|
57
|
+
this.registerActions();
|
|
58
|
+
}
|
|
59
|
+
createMainTitlebarPart() {
|
|
60
|
+
return this.instantiationService.createInstance(MainBrowserTitlebarPart);
|
|
61
|
+
}
|
|
62
|
+
registerActions() {
|
|
63
|
+
const that = this;
|
|
64
|
+
this._register(registerAction2(class FocusTitleBar extends Action2 {
|
|
65
|
+
constructor() {
|
|
66
|
+
super({
|
|
67
|
+
id: `workbench.action.focusTitleBar`,
|
|
68
|
+
title: ( localize2WithPath(
|
|
69
|
+
'vs/workbench/browser/parts/titlebar/titlebarPart',
|
|
70
|
+
'focusTitleBar',
|
|
71
|
+
'Focus Title Bar'
|
|
72
|
+
)),
|
|
73
|
+
category: Categories.View,
|
|
74
|
+
f1: true,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
run() {
|
|
78
|
+
that.getPartByDocument(getActiveDocument()).focus();
|
|
79
|
+
}
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
createAuxiliaryTitlebarPart(container, editorGroupsContainer) {
|
|
83
|
+
const titlebarPartContainer = document.createElement('div');
|
|
84
|
+
titlebarPartContainer.classList.add('part', 'titlebar');
|
|
85
|
+
titlebarPartContainer.setAttribute('role', 'none');
|
|
86
|
+
titlebarPartContainer.style.position = 'relative';
|
|
87
|
+
container.insertBefore(titlebarPartContainer, container.firstChild);
|
|
88
|
+
const disposables = ( new DisposableStore());
|
|
89
|
+
const titlebarPart = this.doCreateAuxiliaryTitlebarPart(titlebarPartContainer, editorGroupsContainer);
|
|
90
|
+
disposables.add(this.registerPart(titlebarPart));
|
|
91
|
+
disposables.add(Event.runAndSubscribe(titlebarPart.onDidChange, () => titlebarPartContainer.style.height = `${titlebarPart.height}px`));
|
|
92
|
+
titlebarPart.create(titlebarPartContainer);
|
|
93
|
+
if (this.properties) {
|
|
94
|
+
titlebarPart.updateProperties(this.properties);
|
|
95
|
+
}
|
|
96
|
+
if (this.variables.length) {
|
|
97
|
+
titlebarPart.registerVariables(this.variables);
|
|
98
|
+
}
|
|
99
|
+
Event.once(titlebarPart.onWillDispose)(() => disposables.dispose());
|
|
100
|
+
return titlebarPart;
|
|
101
|
+
}
|
|
102
|
+
doCreateAuxiliaryTitlebarPart(container, editorGroupsContainer) {
|
|
103
|
+
return this.instantiationService.createInstance(AuxiliaryBrowserTitlebarPart, container, editorGroupsContainer, this.mainPart);
|
|
104
|
+
}
|
|
105
|
+
updateProperties(properties) {
|
|
106
|
+
this.properties = properties;
|
|
107
|
+
for (const part of this.parts) {
|
|
108
|
+
part.updateProperties(properties);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
registerVariables(variables) {
|
|
112
|
+
this.variables.push(...variables);
|
|
113
|
+
for (const part of this.parts) {
|
|
114
|
+
part.registerVariables(variables);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
BrowserTitleService = ( __decorate([
|
|
119
|
+
( __param(0, IInstantiationService)),
|
|
120
|
+
( __param(1, IStorageService)),
|
|
121
|
+
( __param(2, IThemeService))
|
|
122
|
+
], BrowserTitleService));
|
|
123
|
+
let BrowserTitlebarPart = class BrowserTitlebarPart extends Part {
|
|
124
|
+
get minimumHeight() {
|
|
125
|
+
const value = this.isCommandCenterVisible || (isWeb && isWCOEnabled()) ? 35 : 30;
|
|
126
|
+
return value / (this.preventZoom ? getZoomFactor(getWindow(this.element)) : 1);
|
|
127
|
+
}
|
|
128
|
+
get maximumHeight() { return this.minimumHeight; }
|
|
129
|
+
constructor(id, targetWindow, editorGroupsContainer, contextMenuService, configurationService, environmentService, instantiationService, themeService, storageService, layoutService, contextKeyService, hostService, editorGroupService, editorService, menuService, keybindingService) {
|
|
130
|
+
super(id, { hasTitle: false }, themeService, storageService, layoutService);
|
|
131
|
+
this.contextMenuService = contextMenuService;
|
|
132
|
+
this.configurationService = configurationService;
|
|
133
|
+
this.environmentService = environmentService;
|
|
134
|
+
this.instantiationService = instantiationService;
|
|
135
|
+
this.contextKeyService = contextKeyService;
|
|
136
|
+
this.hostService = hostService;
|
|
137
|
+
this.editorGroupService = editorGroupService;
|
|
138
|
+
this.menuService = menuService;
|
|
139
|
+
this.keybindingService = keybindingService;
|
|
140
|
+
this.minimumWidth = 0;
|
|
141
|
+
this.maximumWidth = Number.POSITIVE_INFINITY;
|
|
142
|
+
this._onMenubarVisibilityChange = this._register(( new Emitter()));
|
|
143
|
+
this.onMenubarVisibilityChange = this._onMenubarVisibilityChange.event;
|
|
144
|
+
this._onWillDispose = this._register(( new Emitter()));
|
|
145
|
+
this.onWillDispose = this._onWillDispose.event;
|
|
146
|
+
this.actionToolBarDisposable = this._register(( new DisposableStore()));
|
|
147
|
+
this.editorActionsChangeDisposable = this._register(( new DisposableStore()));
|
|
148
|
+
this.editorToolbarMenuDisposables = this._register(( new DisposableStore()));
|
|
149
|
+
this.layoutToolbarMenuDisposables = this._register(( new DisposableStore()));
|
|
150
|
+
this.titleDisposables = this._register(( new DisposableStore()));
|
|
151
|
+
this.titleBarStyle = getTitleBarStyle(this.configurationService);
|
|
152
|
+
this.isInactive = false;
|
|
153
|
+
this.isAuxiliary = editorGroupsContainer !== 'main';
|
|
154
|
+
this.editorService = editorService.createScoped(editorGroupsContainer, this._store);
|
|
155
|
+
this.editorGroupsContainer = editorGroupsContainer === 'main' ? editorGroupService.mainPart : editorGroupsContainer;
|
|
156
|
+
this.windowTitle = this._register(instantiationService.createInstance(WindowTitle, targetWindow, editorGroupsContainer));
|
|
157
|
+
this.hoverDelegate = this._register(createInstantHoverDelegate());
|
|
158
|
+
this.registerListeners(getWindowId(targetWindow));
|
|
159
|
+
}
|
|
160
|
+
registerListeners(targetWindowId) {
|
|
161
|
+
this._register(this.hostService.onDidChangeFocus(focused => focused ? this.onFocus() : this.onBlur()));
|
|
162
|
+
this._register(this.hostService.onDidChangeActiveWindow(windowId => windowId === targetWindowId ? this.onFocus() : this.onBlur()));
|
|
163
|
+
this._register(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationChanged(e)));
|
|
164
|
+
this._register(this.editorGroupService.onDidChangeEditorPartOptions(e => this.onEditorPartConfigurationChange(e)));
|
|
165
|
+
}
|
|
166
|
+
onBlur() {
|
|
167
|
+
this.isInactive = true;
|
|
168
|
+
this.updateStyles();
|
|
169
|
+
}
|
|
170
|
+
onFocus() {
|
|
171
|
+
this.isInactive = false;
|
|
172
|
+
this.updateStyles();
|
|
173
|
+
}
|
|
174
|
+
onEditorPartConfigurationChange({ oldPartOptions, newPartOptions }) {
|
|
175
|
+
if (oldPartOptions.editorActionsLocation !== newPartOptions.editorActionsLocation ||
|
|
176
|
+
oldPartOptions.showTabs !== newPartOptions.showTabs) {
|
|
177
|
+
if (this.actionToolBar) {
|
|
178
|
+
this.createActionToolBar();
|
|
179
|
+
this.createActionToolBarMenus({ editorActions: true });
|
|
180
|
+
this._onDidChange.fire(undefined);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
onConfigurationChanged(event) {
|
|
185
|
+
if (!this.isAuxiliary && !hasNativeTitlebar(this.configurationService, this.titleBarStyle) && (!isMacintosh || isWeb)) {
|
|
186
|
+
if (event.affectsConfiguration('window.menuBarVisibility')) {
|
|
187
|
+
if (this.currentMenubarVisibility === 'compact') {
|
|
188
|
+
this.uninstallMenubar();
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
this.installMenubar();
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (this.actionToolBar) {
|
|
196
|
+
const affectsLayoutControl = event.affectsConfiguration("workbench.layoutControl.enabled" );
|
|
197
|
+
const affectsActivityControl = event.affectsConfiguration("workbench.activityBar.location" );
|
|
198
|
+
if (affectsLayoutControl || affectsActivityControl) {
|
|
199
|
+
this.createActionToolBarMenus({ layoutActions: affectsLayoutControl, activityActions: affectsActivityControl });
|
|
200
|
+
this._onDidChange.fire(undefined);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
if (event.affectsConfiguration("window.commandCenter" )) {
|
|
204
|
+
this.createTitle();
|
|
205
|
+
this._onDidChange.fire(undefined);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
installMenubar() {
|
|
209
|
+
if (this.menubar) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
this.customMenubar = this._register(this.instantiationService.createInstance(CustomMenubarControl));
|
|
213
|
+
this.menubar = append(this.leftContent, $('div.menubar'));
|
|
214
|
+
this.menubar.setAttribute('role', 'menubar');
|
|
215
|
+
this._register(this.customMenubar.onVisibilityChange(e => this.onMenubarVisibilityChanged(e)));
|
|
216
|
+
this.customMenubar.create(this.menubar);
|
|
217
|
+
}
|
|
218
|
+
uninstallMenubar() {
|
|
219
|
+
this.customMenubar?.dispose();
|
|
220
|
+
this.customMenubar = undefined;
|
|
221
|
+
this.menubar?.remove();
|
|
222
|
+
this.menubar = undefined;
|
|
223
|
+
this.onMenubarVisibilityChanged(false);
|
|
224
|
+
}
|
|
225
|
+
onMenubarVisibilityChanged(visible) {
|
|
226
|
+
if (isWeb || isWindows || isLinux) {
|
|
227
|
+
if (this.lastLayoutDimensions) {
|
|
228
|
+
this.layout(this.lastLayoutDimensions.width, this.lastLayoutDimensions.height);
|
|
229
|
+
}
|
|
230
|
+
this._onMenubarVisibilityChange.fire(visible);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
updateProperties(properties) {
|
|
234
|
+
this.windowTitle.updateProperties(properties);
|
|
235
|
+
}
|
|
236
|
+
registerVariables(variables) {
|
|
237
|
+
this.windowTitle.registerVariables(variables);
|
|
238
|
+
}
|
|
239
|
+
createContentArea(parent) {
|
|
240
|
+
this.element = parent;
|
|
241
|
+
this.rootContainer = append(parent, $('.titlebar-container'));
|
|
242
|
+
this.leftContent = append(this.rootContainer, $('.titlebar-left'));
|
|
243
|
+
this.centerContent = append(this.rootContainer, $('.titlebar-center'));
|
|
244
|
+
this.rightContent = append(this.rootContainer, $('.titlebar-right'));
|
|
245
|
+
if (!isMacintosh && !isWeb && !hasNativeTitlebar(this.configurationService, this.titleBarStyle)) {
|
|
246
|
+
this.appIcon = prepend(this.leftContent, $('a.window-appicon'));
|
|
247
|
+
if (!this.isAuxiliary && isWeb) {
|
|
248
|
+
const homeIndicator = this.environmentService.options?.homeIndicator;
|
|
249
|
+
if (homeIndicator) {
|
|
250
|
+
const icon = getIconRegistry().getIcon(homeIndicator.icon) ? { id: homeIndicator.icon } : Codicon.code;
|
|
251
|
+
this.appIcon.setAttribute('href', homeIndicator.href);
|
|
252
|
+
this.appIcon.classList.add(...ThemeIcon.asClassNameArray(icon));
|
|
253
|
+
this.appIconBadge = document.createElement('div');
|
|
254
|
+
this.appIconBadge.classList.add('home-bar-icon-badge');
|
|
255
|
+
this.appIcon.appendChild(this.appIconBadge);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
this.dragRegion = prepend(this.rootContainer, $('div.titlebar-drag-region'));
|
|
260
|
+
if (!this.isAuxiliary &&
|
|
261
|
+
!hasNativeTitlebar(this.configurationService, this.titleBarStyle) &&
|
|
262
|
+
(!isMacintosh || isWeb) &&
|
|
263
|
+
this.currentMenubarVisibility !== 'compact') {
|
|
264
|
+
this.installMenubar();
|
|
265
|
+
}
|
|
266
|
+
this.title = append(this.centerContent, $('div.window-title'));
|
|
267
|
+
this.createTitle();
|
|
268
|
+
{
|
|
269
|
+
this.actionToolBarElement = append(this.rightContent, $('div.action-toolbar-container'));
|
|
270
|
+
this.createActionToolBar();
|
|
271
|
+
this.createActionToolBarMenus();
|
|
272
|
+
}
|
|
273
|
+
let primaryControlLocation = isMacintosh ? 'left' : 'right';
|
|
274
|
+
if (isMacintosh && isNative) {
|
|
275
|
+
const localeInfo = new Intl.Locale(platformLocale);
|
|
276
|
+
if (localeInfo?.textInfo?.direction === 'rtl') {
|
|
277
|
+
primaryControlLocation = 'right';
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
if (!hasNativeTitlebar(this.configurationService, this.titleBarStyle)) {
|
|
281
|
+
this.primaryWindowControls = append(primaryControlLocation === 'left' ? this.leftContent : this.rightContent, $('div.window-controls-container.primary'));
|
|
282
|
+
append(primaryControlLocation === 'left' ? this.rightContent : this.leftContent, $('div.window-controls-container.secondary'));
|
|
283
|
+
}
|
|
284
|
+
{
|
|
285
|
+
this._register(addDisposableListener(this.rootContainer, EventType.CONTEXT_MENU, e => {
|
|
286
|
+
EventHelper.stop(e);
|
|
287
|
+
let targetMenu;
|
|
288
|
+
if (isMacintosh && e.target instanceof HTMLElement && isAncestor(e.target, this.title)) {
|
|
289
|
+
targetMenu = MenuId.TitleBarTitleContext;
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
targetMenu = MenuId.TitleBarContext;
|
|
293
|
+
}
|
|
294
|
+
this.onContextMenu(e, targetMenu);
|
|
295
|
+
}));
|
|
296
|
+
if (isMacintosh) {
|
|
297
|
+
this._register(addDisposableListener(this.title, EventType.MOUSE_DOWN, e => {
|
|
298
|
+
if (e.metaKey) {
|
|
299
|
+
EventHelper.stop(e, true );
|
|
300
|
+
this.onContextMenu(e, MenuId.TitleBarTitleContext);
|
|
301
|
+
}
|
|
302
|
+
}, true ));
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
this.updateStyles();
|
|
306
|
+
return this.element;
|
|
307
|
+
}
|
|
308
|
+
createTitle() {
|
|
309
|
+
this.titleDisposables.clear();
|
|
310
|
+
if (!this.isCommandCenterVisible) {
|
|
311
|
+
this.title.innerText = this.windowTitle.value;
|
|
312
|
+
this.titleDisposables.add(this.windowTitle.onDidChange(() => {
|
|
313
|
+
this.title.innerText = this.windowTitle.value;
|
|
314
|
+
}));
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
const commandCenter = this.instantiationService.createInstance(CommandCenterControl, this.windowTitle, this.hoverDelegate);
|
|
318
|
+
reset(this.title, commandCenter.element);
|
|
319
|
+
this.titleDisposables.add(commandCenter);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
actionViewItemProvider(action, options) {
|
|
323
|
+
if (!this.isAuxiliary) {
|
|
324
|
+
if (action.id === GLOBAL_ACTIVITY_ID) {
|
|
325
|
+
return this.instantiationService.createInstance(SimpleGlobalActivityActionViewItem, { position: () => 2 }, options);
|
|
326
|
+
}
|
|
327
|
+
if (action.id === ACCOUNTS_ACTIVITY_ID) {
|
|
328
|
+
return this.instantiationService.createInstance(SimpleAccountActivityActionViewItem, { position: () => 2 }, options);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
const activeEditorPane = this.editorGroupsContainer.activeGroup?.activeEditorPane;
|
|
332
|
+
if (activeEditorPane && activeEditorPane instanceof EditorPane) {
|
|
333
|
+
const result = activeEditorPane.getActionViewItem(action, options);
|
|
334
|
+
if (result) {
|
|
335
|
+
return result;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
return createActionViewItem(this.instantiationService, action, { ...options, menuAsChild: false });
|
|
339
|
+
}
|
|
340
|
+
getKeybinding(action) {
|
|
341
|
+
const editorPaneAwareContextKeyService = this.editorGroupsContainer.activeGroup?.activeEditorPane?.scopedContextKeyService ?? this.contextKeyService;
|
|
342
|
+
return this.keybindingService.lookupKeybinding(action.id, editorPaneAwareContextKeyService);
|
|
343
|
+
}
|
|
344
|
+
createActionToolBar() {
|
|
345
|
+
this.actionToolBarDisposable.clear();
|
|
346
|
+
this.actionToolBar = this.actionToolBarDisposable.add(this.instantiationService.createInstance(WorkbenchToolBar, this.actionToolBarElement, {
|
|
347
|
+
contextMenu: MenuId.TitleBarContext,
|
|
348
|
+
orientation: 0 ,
|
|
349
|
+
ariaLabel: ( localizeWithPath(
|
|
350
|
+
'vs/workbench/browser/parts/titlebar/titlebarPart',
|
|
351
|
+
'ariaLabelTitleActions',
|
|
352
|
+
"Title actions"
|
|
353
|
+
)),
|
|
354
|
+
getKeyBinding: action => this.getKeybinding(action),
|
|
355
|
+
overflowBehavior: { maxItems: 9, exempted: [ACCOUNTS_ACTIVITY_ID, GLOBAL_ACTIVITY_ID, ...EDITOR_CORE_NAVIGATION_COMMANDS] },
|
|
356
|
+
anchorAlignmentProvider: () => 1 ,
|
|
357
|
+
telemetrySource: 'titlePart',
|
|
358
|
+
highlightToggledItems: this.editorActionsEnabled,
|
|
359
|
+
actionViewItemProvider: (action, options) => this.actionViewItemProvider(action, options),
|
|
360
|
+
hoverDelegate: this.hoverDelegate
|
|
361
|
+
}));
|
|
362
|
+
if (this.editorActionsEnabled) {
|
|
363
|
+
this.actionToolBarDisposable.add(this.editorGroupsContainer.onDidChangeActiveGroup(() => this.createActionToolBarMenus({ editorActions: true })));
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
createActionToolBarMenus(update = true) {
|
|
367
|
+
if (update === true) {
|
|
368
|
+
update = { editorActions: true, layoutActions: true, activityActions: true };
|
|
369
|
+
}
|
|
370
|
+
const updateToolBarActions = () => {
|
|
371
|
+
const actions = { primary: [], secondary: [] };
|
|
372
|
+
if (this.editorActionsEnabled) {
|
|
373
|
+
this.editorActionsChangeDisposable.clear();
|
|
374
|
+
const activeGroup = this.editorGroupsContainer.activeGroup;
|
|
375
|
+
if (activeGroup) {
|
|
376
|
+
const editorActions = activeGroup.createEditorActions(this.editorActionsChangeDisposable);
|
|
377
|
+
actions.primary.push(...editorActions.actions.primary);
|
|
378
|
+
actions.secondary.push(...editorActions.actions.secondary);
|
|
379
|
+
this.editorActionsChangeDisposable.add(editorActions.onDidChange(() => updateToolBarActions()));
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
if (this.layoutToolbarMenu) {
|
|
383
|
+
createAndFillInActionBarActions(this.layoutToolbarMenu, {}, actions, () => !this.editorActionsEnabled
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
if (this.activityActionsEnabled) {
|
|
387
|
+
actions.primary.push(ACCOUNTS_ACTIVITY_TILE_ACTION);
|
|
388
|
+
actions.primary.push(GLOBAL_ACTIVITY_TITLE_ACTION);
|
|
389
|
+
}
|
|
390
|
+
this.actionToolBar.setActions(prepareActions(actions.primary), prepareActions(actions.secondary));
|
|
391
|
+
};
|
|
392
|
+
if (update.editorActions) {
|
|
393
|
+
this.editorToolbarMenuDisposables.clear();
|
|
394
|
+
if (this.editorActionsEnabled && this.editorService.activeEditor !== undefined) {
|
|
395
|
+
const context = { groupId: this.editorGroupsContainer.activeGroup.id };
|
|
396
|
+
this.actionToolBar.actionRunner = ( new EditorCommandsContextActionRunner(context));
|
|
397
|
+
this.actionToolBar.context = context;
|
|
398
|
+
this.editorToolbarMenuDisposables.add(this.actionToolBar.actionRunner);
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
this.actionToolBar.actionRunner = ( new ActionRunner());
|
|
402
|
+
this.actionToolBar.context = {};
|
|
403
|
+
this.editorToolbarMenuDisposables.add(this.actionToolBar.actionRunner);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
if (update.layoutActions) {
|
|
407
|
+
this.layoutToolbarMenuDisposables.clear();
|
|
408
|
+
if (this.layoutControlEnabled) {
|
|
409
|
+
this.layoutToolbarMenu = this.menuService.createMenu(MenuId.LayoutControlMenu, this.contextKeyService);
|
|
410
|
+
this.layoutToolbarMenuDisposables.add(this.layoutToolbarMenu);
|
|
411
|
+
this.layoutToolbarMenuDisposables.add(this.layoutToolbarMenu.onDidChange(() => updateToolBarActions()));
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
this.layoutToolbarMenu = undefined;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
updateToolBarActions();
|
|
418
|
+
}
|
|
419
|
+
updateStyles() {
|
|
420
|
+
super.updateStyles();
|
|
421
|
+
if (this.element) {
|
|
422
|
+
if (this.isInactive) {
|
|
423
|
+
this.element.classList.add('inactive');
|
|
424
|
+
}
|
|
425
|
+
else {
|
|
426
|
+
this.element.classList.remove('inactive');
|
|
427
|
+
}
|
|
428
|
+
const titleBackground = this.getColor(this.isInactive ? TITLE_BAR_INACTIVE_BACKGROUND : TITLE_BAR_ACTIVE_BACKGROUND, (color, theme) => {
|
|
429
|
+
return color.isOpaque() ? color : color.makeOpaque(WORKBENCH_BACKGROUND(theme));
|
|
430
|
+
}) || '';
|
|
431
|
+
this.element.style.backgroundColor = titleBackground;
|
|
432
|
+
if (this.appIconBadge) {
|
|
433
|
+
this.appIconBadge.style.backgroundColor = titleBackground;
|
|
434
|
+
}
|
|
435
|
+
if (titleBackground && ( Color.fromHex(titleBackground)).isLighter()) {
|
|
436
|
+
this.element.classList.add('light');
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
this.element.classList.remove('light');
|
|
440
|
+
}
|
|
441
|
+
const titleForeground = this.getColor(this.isInactive ? TITLE_BAR_INACTIVE_FOREGROUND : TITLE_BAR_ACTIVE_FOREGROUND);
|
|
442
|
+
this.element.style.color = titleForeground || '';
|
|
443
|
+
const titleBorder = this.getColor(TITLE_BAR_BORDER);
|
|
444
|
+
this.element.style.borderBottom = titleBorder ? `1px solid ${titleBorder}` : '';
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
onContextMenu(e, menuId) {
|
|
448
|
+
const event = ( new StandardMouseEvent(getWindow(this.element), e));
|
|
449
|
+
this.contextMenuService.showContextMenu({
|
|
450
|
+
getAnchor: () => event,
|
|
451
|
+
menuId,
|
|
452
|
+
contextKeyService: this.contextKeyService,
|
|
453
|
+
domForShadowRoot: isMacintosh && isNative ? event.target : undefined
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
get currentMenubarVisibility() {
|
|
457
|
+
if (this.isAuxiliary) {
|
|
458
|
+
return 'hidden';
|
|
459
|
+
}
|
|
460
|
+
return getMenuBarVisibility(this.configurationService);
|
|
461
|
+
}
|
|
462
|
+
get layoutControlEnabled() {
|
|
463
|
+
return !this.isAuxiliary && this.configurationService.getValue("workbench.layoutControl.enabled" ) !== false;
|
|
464
|
+
}
|
|
465
|
+
get isCommandCenterVisible() {
|
|
466
|
+
return this.configurationService.getValue("window.commandCenter" ) !== false;
|
|
467
|
+
}
|
|
468
|
+
get editorActionsEnabled() {
|
|
469
|
+
return this.editorGroupService.partOptions.editorActionsLocation === "titleBar" ||
|
|
470
|
+
((this.editorGroupService.partOptions.editorActionsLocation === "default" && this.editorGroupService.partOptions.showTabs === "none") );
|
|
471
|
+
}
|
|
472
|
+
get activityActionsEnabled() {
|
|
473
|
+
const activityBarPosition = this.configurationService.getValue("workbench.activityBar.location" );
|
|
474
|
+
return !this.isAuxiliary && ((activityBarPosition === "top" || activityBarPosition === "bottom") );
|
|
475
|
+
}
|
|
476
|
+
get hasZoomableElements() {
|
|
477
|
+
const hasMenubar = !(this.currentMenubarVisibility === 'hidden' || this.currentMenubarVisibility === 'compact' || (!isWeb && isMacintosh));
|
|
478
|
+
const hasCommandCenter = this.isCommandCenterVisible;
|
|
479
|
+
const hasToolBarActions = this.layoutControlEnabled || this.editorActionsEnabled || this.activityActionsEnabled;
|
|
480
|
+
return hasMenubar || hasCommandCenter || hasToolBarActions;
|
|
481
|
+
}
|
|
482
|
+
get preventZoom() {
|
|
483
|
+
return getZoomFactor(getWindow(this.element)) < 1 || !this.hasZoomableElements;
|
|
484
|
+
}
|
|
485
|
+
layout(width, height) {
|
|
486
|
+
this.updateLayout(( new Dimension(width, height)));
|
|
487
|
+
super.layoutContents(width, height);
|
|
488
|
+
}
|
|
489
|
+
updateLayout(dimension) {
|
|
490
|
+
this.lastLayoutDimensions = dimension;
|
|
491
|
+
{
|
|
492
|
+
const zoomFactor = getZoomFactor(getWindow(this.element));
|
|
493
|
+
this.element.style.setProperty('--zoom-factor', ( zoomFactor.toString()));
|
|
494
|
+
this.rootContainer.classList.toggle('counter-zoom', this.preventZoom);
|
|
495
|
+
if (this.customMenubar) {
|
|
496
|
+
const menubarDimension = ( new Dimension(0, dimension.height));
|
|
497
|
+
this.customMenubar.layout(menubarDimension);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
focus() {
|
|
502
|
+
if (this.customMenubar) {
|
|
503
|
+
this.customMenubar.toggleFocus();
|
|
504
|
+
}
|
|
505
|
+
else {
|
|
506
|
+
this.element.querySelector('[tabindex]:not([tabindex="-1"])').focus();
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
toJSON() {
|
|
510
|
+
return {
|
|
511
|
+
type: "workbench.parts.titlebar"
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
dispose() {
|
|
515
|
+
this._onWillDispose.fire();
|
|
516
|
+
super.dispose();
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
BrowserTitlebarPart = ( __decorate([
|
|
520
|
+
( __param(3, IContextMenuService)),
|
|
521
|
+
( __param(4, IConfigurationService)),
|
|
522
|
+
( __param(5, IBrowserWorkbenchEnvironmentService)),
|
|
523
|
+
( __param(6, IInstantiationService)),
|
|
524
|
+
( __param(7, IThemeService)),
|
|
525
|
+
( __param(8, IStorageService)),
|
|
526
|
+
( __param(9, IWorkbenchLayoutService)),
|
|
527
|
+
( __param(10, IContextKeyService)),
|
|
528
|
+
( __param(11, IHostService)),
|
|
529
|
+
( __param(12, IEditorGroupsService)),
|
|
530
|
+
( __param(13, IEditorService)),
|
|
531
|
+
( __param(14, IMenuService)),
|
|
532
|
+
( __param(15, IKeybindingService))
|
|
533
|
+
], BrowserTitlebarPart));
|
|
534
|
+
let MainBrowserTitlebarPart = class MainBrowserTitlebarPart extends BrowserTitlebarPart {
|
|
535
|
+
constructor(contextMenuService, configurationService, environmentService, instantiationService, themeService, storageService, layoutService, contextKeyService, hostService, editorGroupService, editorService, menuService, keybindingService) {
|
|
536
|
+
super("workbench.parts.titlebar" , mainWindow, 'main', contextMenuService, configurationService, environmentService, instantiationService, themeService, storageService, layoutService, contextKeyService, hostService, editorGroupService, editorService, menuService, keybindingService);
|
|
537
|
+
}
|
|
538
|
+
};
|
|
539
|
+
MainBrowserTitlebarPart = ( __decorate([
|
|
540
|
+
( __param(0, IContextMenuService)),
|
|
541
|
+
( __param(1, IConfigurationService)),
|
|
542
|
+
( __param(2, IBrowserWorkbenchEnvironmentService)),
|
|
543
|
+
( __param(3, IInstantiationService)),
|
|
544
|
+
( __param(4, IThemeService)),
|
|
545
|
+
( __param(5, IStorageService)),
|
|
546
|
+
( __param(6, IWorkbenchLayoutService)),
|
|
547
|
+
( __param(7, IContextKeyService)),
|
|
548
|
+
( __param(8, IHostService)),
|
|
549
|
+
( __param(9, IEditorGroupsService)),
|
|
550
|
+
( __param(10, IEditorService)),
|
|
551
|
+
( __param(11, IMenuService)),
|
|
552
|
+
( __param(12, IKeybindingService))
|
|
553
|
+
], MainBrowserTitlebarPart));
|
|
554
|
+
let AuxiliaryBrowserTitlebarPart = class AuxiliaryBrowserTitlebarPart extends BrowserTitlebarPart {
|
|
555
|
+
static { AuxiliaryBrowserTitlebarPart_1 = this; }
|
|
556
|
+
static { this.COUNTER = 1; }
|
|
557
|
+
get height() { return this.minimumHeight; }
|
|
558
|
+
constructor(container, editorGroupsContainer, mainTitlebar, contextMenuService, configurationService, environmentService, instantiationService, themeService, storageService, layoutService, contextKeyService, hostService, editorGroupService, editorService, menuService, keybindingService) {
|
|
559
|
+
const id = AuxiliaryBrowserTitlebarPart_1.COUNTER++;
|
|
560
|
+
super(`workbench.parts.auxiliaryTitle.${id}`, getWindow(container), editorGroupsContainer, contextMenuService, configurationService, environmentService, instantiationService, themeService, storageService, layoutService, contextKeyService, hostService, editorGroupService, editorService, menuService, keybindingService);
|
|
561
|
+
this.container = container;
|
|
562
|
+
this.mainTitlebar = mainTitlebar;
|
|
563
|
+
}
|
|
564
|
+
get preventZoom() {
|
|
565
|
+
return getZoomFactor(getWindow(this.element)) < 1 || !this.mainTitlebar.hasZoomableElements;
|
|
566
|
+
}
|
|
567
|
+
};
|
|
568
|
+
AuxiliaryBrowserTitlebarPart = AuxiliaryBrowserTitlebarPart_1 = ( __decorate([
|
|
569
|
+
( __param(3, IContextMenuService)),
|
|
570
|
+
( __param(4, IConfigurationService)),
|
|
571
|
+
( __param(5, IBrowserWorkbenchEnvironmentService)),
|
|
572
|
+
( __param(6, IInstantiationService)),
|
|
573
|
+
( __param(7, IThemeService)),
|
|
574
|
+
( __param(8, IStorageService)),
|
|
575
|
+
( __param(9, IWorkbenchLayoutService)),
|
|
576
|
+
( __param(10, IContextKeyService)),
|
|
577
|
+
( __param(11, IHostService)),
|
|
578
|
+
( __param(12, IEditorGroupsService)),
|
|
579
|
+
( __param(13, IEditorService)),
|
|
580
|
+
( __param(14, IMenuService)),
|
|
581
|
+
( __param(15, IKeybindingService))
|
|
582
|
+
], AuxiliaryBrowserTitlebarPart));
|
|
583
|
+
|
|
584
|
+
export { AuxiliaryBrowserTitlebarPart, BrowserTitleService, BrowserTitlebarPart, MainBrowserTitlebarPart };
|