@theia/core 1.18.0 → 1.19.0
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/README.md +3 -2
- package/lib/browser/about-dialog.d.ts.map +1 -1
- package/lib/browser/about-dialog.js +1 -1
- package/lib/browser/about-dialog.js.map +1 -1
- package/lib/browser/authentication-service.d.ts.map +1 -1
- package/lib/browser/authentication-service.js +1 -1
- package/lib/browser/authentication-service.js.map +1 -1
- package/lib/browser/common-frontend-contribution.d.ts +6 -0
- package/lib/browser/common-frontend-contribution.d.ts.map +1 -1
- package/lib/browser/common-frontend-contribution.js +122 -118
- package/lib/browser/common-frontend-contribution.js.map +1 -1
- package/lib/browser/core-preferences.d.ts +1 -0
- package/lib/browser/core-preferences.d.ts.map +1 -1
- package/lib/browser/core-preferences.js +25 -18
- package/lib/browser/core-preferences.js.map +1 -1
- package/lib/browser/dialogs.d.ts +6 -0
- package/lib/browser/dialogs.d.ts.map +1 -1
- package/lib/browser/dialogs.js +10 -3
- package/lib/browser/dialogs.js.map +1 -1
- package/lib/browser/frontend-application-module.d.ts.map +1 -1
- package/lib/browser/frontend-application-module.js +3 -0
- package/lib/browser/frontend-application-module.js.map +1 -1
- package/lib/browser/frontend-application.d.ts +6 -0
- package/lib/browser/frontend-application.d.ts.map +1 -1
- package/lib/browser/frontend-application.js +13 -0
- package/lib/browser/frontend-application.js.map +1 -1
- package/lib/browser/index.d.ts +1 -0
- package/lib/browser/index.d.ts.map +1 -1
- package/lib/browser/index.js +1 -0
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/keyboard/browser-keyboard-frontend-contribution.d.ts.map +1 -1
- package/lib/browser/keyboard/browser-keyboard-frontend-contribution.js +16 -11
- package/lib/browser/keyboard/browser-keyboard-frontend-contribution.js.map +1 -1
- package/lib/browser/menu/browser-context-menu-renderer.d.ts +1 -1
- package/lib/browser/menu/browser-context-menu-renderer.d.ts.map +1 -1
- package/lib/browser/menu/browser-menu-plugin.d.ts +3 -0
- package/lib/browser/menu/browser-menu-plugin.d.ts.map +1 -1
- package/lib/browser/menu/browser-menu-plugin.js +24 -4
- package/lib/browser/menu/browser-menu-plugin.js.map +1 -1
- package/lib/browser/nls-loader.d.ts +17 -0
- package/lib/browser/nls-loader.d.ts.map +1 -0
- package/lib/browser/nls-loader.js +29 -0
- package/lib/browser/nls-loader.js.map +1 -0
- package/lib/browser/progress-status-bar-item.d.ts +1 -2
- package/lib/browser/progress-status-bar-item.d.ts.map +1 -1
- package/lib/browser/progress-status-bar-item.js.map +1 -1
- package/lib/browser/quick-input/quick-command-frontend-contribution.d.ts.map +1 -1
- package/lib/browser/quick-input/quick-command-frontend-contribution.js +2 -1
- package/lib/browser/quick-input/quick-command-frontend-contribution.js.map +1 -1
- package/lib/browser/quick-input/quick-command-service.d.ts.map +1 -1
- package/lib/browser/quick-input/quick-command-service.js +2 -2
- package/lib/browser/quick-input/quick-command-service.js.map +1 -1
- package/lib/browser/quick-input/quick-view-service.d.ts +1 -2
- package/lib/browser/quick-input/quick-view-service.d.ts.map +1 -1
- package/lib/browser/quick-input/quick-view-service.js.map +1 -1
- package/lib/browser/shell/application-shell.d.ts +3 -1
- package/lib/browser/shell/application-shell.d.ts.map +1 -1
- package/lib/browser/shell/application-shell.js +1 -2
- package/lib/browser/shell/application-shell.js.map +1 -1
- package/lib/browser/shell/shell-layout-restorer.d.ts.map +1 -1
- package/lib/browser/shell/shell-layout-restorer.js +5 -3
- package/lib/browser/shell/shell-layout-restorer.js.map +1 -1
- package/lib/browser/shell/tab-bar-decorator.d.ts +1 -1
- package/lib/browser/shell/tab-bar-decorator.d.ts.map +1 -1
- package/lib/browser/shell/tab-bar-decorator.js.map +1 -1
- package/lib/browser/shell/tab-bar-toolbar.d.ts.map +1 -1
- package/lib/browser/shell/tab-bar-toolbar.js +2 -1
- package/lib/browser/shell/tab-bar-toolbar.js.map +1 -1
- package/lib/browser/shell/tab-bars.d.ts +14 -1
- package/lib/browser/shell/tab-bars.d.ts.map +1 -1
- package/lib/browser/shell/tab-bars.js +99 -7
- package/lib/browser/shell/tab-bars.js.map +1 -1
- package/lib/browser/tooltip-service.d.ts +52 -0
- package/lib/browser/tooltip-service.d.ts.map +1 -0
- package/lib/browser/tooltip-service.js +89 -0
- package/lib/browser/tooltip-service.js.map +1 -0
- package/lib/browser/tree/tree-model.d.ts.map +1 -1
- package/lib/browser/view-container.d.ts +55 -14
- package/lib/browser/view-container.d.ts.map +1 -1
- package/lib/browser/view-container.js +284 -66
- package/lib/browser/view-container.js.map +1 -1
- package/lib/browser/window/default-window-service.js +2 -2
- package/lib/browser/window/default-window-service.js.map +1 -1
- package/lib/browser/window/window-service.d.ts +1 -7
- package/lib/browser/window/window-service.d.ts.map +1 -1
- package/lib/browser/window/window-service.js +1 -5
- package/lib/browser/window/window-service.js.map +1 -1
- package/lib/browser/window-contribution.d.ts.map +1 -1
- package/lib/browser/window-contribution.js +2 -2
- package/lib/browser/window-contribution.js.map +1 -1
- package/lib/common/command.d.ts.map +1 -1
- package/lib/common/command.js +1 -2
- package/lib/common/command.js.map +1 -1
- package/lib/common/i18n/localization.d.ts +5 -0
- package/lib/common/i18n/localization.d.ts.map +1 -1
- package/lib/common/i18n/localization.js +43 -1
- package/lib/common/i18n/localization.js.map +1 -1
- package/lib/common/index.d.ts +1 -0
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +1 -0
- package/lib/common/index.js.map +1 -1
- package/lib/{browser → common}/nls.d.ts +3 -2
- package/lib/common/nls.d.ts.map +1 -0
- package/lib/common/nls.js +29 -0
- package/lib/common/nls.js.map +1 -0
- package/lib/common/window.d.ts +29 -0
- package/lib/common/window.d.ts.map +1 -0
- package/lib/common/window.js +23 -0
- package/lib/common/window.js.map +1 -0
- package/lib/electron-browser/menu/electron-context-menu-renderer.d.ts +9 -5
- package/lib/electron-browser/menu/electron-context-menu-renderer.d.ts.map +1 -1
- package/lib/electron-browser/menu/electron-context-menu-renderer.js +40 -15
- package/lib/electron-browser/menu/electron-context-menu-renderer.js.map +1 -1
- package/lib/electron-browser/menu/electron-main-menu-factory.d.ts +5 -8
- package/lib/electron-browser/menu/electron-main-menu-factory.d.ts.map +1 -1
- package/lib/electron-browser/menu/electron-main-menu-factory.js +10 -17
- package/lib/electron-browser/menu/electron-main-menu-factory.js.map +1 -1
- package/lib/electron-browser/menu/electron-menu-contribution.d.ts +15 -7
- package/lib/electron-browser/menu/electron-menu-contribution.d.ts.map +1 -1
- package/lib/electron-browser/menu/electron-menu-contribution.js +112 -42
- package/lib/electron-browser/menu/electron-menu-contribution.js.map +1 -1
- package/lib/electron-browser/window/electron-window-preferences.d.ts +1 -0
- package/lib/electron-browser/window/electron-window-preferences.d.ts.map +1 -1
- package/lib/electron-browser/window/electron-window-preferences.js +12 -1
- package/lib/electron-browser/window/electron-window-preferences.js.map +1 -1
- package/lib/electron-browser/window/electron-window-service.d.ts +1 -1
- package/lib/electron-browser/window/electron-window-service.d.ts.map +1 -1
- package/lib/electron-common/electron-main-window-service.d.ts +1 -1
- package/lib/electron-common/electron-main-window-service.d.ts.map +1 -1
- package/lib/electron-common/electron-main-window-service.js.map +1 -1
- package/lib/electron-common/messaging/electron-messages.d.ts +20 -0
- package/lib/electron-common/messaging/electron-messages.d.ts.map +1 -0
- package/lib/electron-common/messaging/electron-messages.js +23 -0
- package/lib/electron-common/messaging/electron-messages.js.map +1 -0
- package/lib/electron-main/electron-main-application.d.ts +6 -0
- package/lib/electron-main/electron-main-application.d.ts.map +1 -1
- package/lib/electron-main/electron-main-application.js +80 -24
- package/lib/electron-main/electron-main-application.js.map +1 -1
- package/lib/electron-main/electron-main-window-service-impl.d.ts +1 -1
- package/lib/electron-main/electron-main-window-service-impl.d.ts.map +1 -1
- package/lib/electron-main/electron-main-window-service-impl.js.map +1 -1
- package/lib/electron-main/messaging/electron-messaging-contribution.d.ts +1 -1
- package/lib/electron-main/messaging/electron-messaging-contribution.d.ts.map +1 -1
- package/lib/electron-main/messaging/electron-messaging-contribution.js +1 -2
- package/lib/electron-main/messaging/electron-messaging-contribution.js.map +1 -1
- package/package.json +6 -4
- package/shared/@theia/application-package/lib/api.d.ts +1 -0
- package/shared/@theia/application-package/lib/api.js +1 -0
- package/src/browser/about-dialog.tsx +2 -2
- package/src/browser/authentication-service.ts +1 -2
- package/src/browser/common-frontend-contribution.ts +99 -95
- package/src/browser/core-preferences.ts +28 -18
- package/src/browser/dialogs.ts +10 -3
- package/src/browser/frontend-application-module.ts +4 -0
- package/src/browser/frontend-application.ts +13 -0
- package/src/browser/index.ts +1 -0
- package/src/browser/keyboard/browser-keyboard-frontend-contribution.ts +16 -11
- package/src/browser/menu/browser-context-menu-renderer.ts +1 -1
- package/src/browser/menu/browser-menu-plugin.ts +25 -5
- package/src/browser/nls-loader.ts +26 -0
- package/src/browser/progress-status-bar-item.ts +1 -2
- package/src/browser/quick-input/quick-command-frontend-contribution.ts +2 -2
- package/src/browser/quick-input/quick-command-service.ts +2 -2
- package/src/browser/quick-input/quick-view-service.ts +1 -2
- package/src/browser/shell/application-shell.ts +4 -3
- package/src/browser/shell/shell-layout-restorer.ts +4 -3
- package/src/browser/shell/tab-bar-decorator.ts +1 -1
- package/src/browser/shell/tab-bar-toolbar.tsx +3 -1
- package/src/browser/shell/tab-bars.ts +103 -8
- package/src/browser/style/index.css +5 -0
- package/src/browser/style/sidepanel.css +8 -2
- package/src/browser/style/tabs.css +30 -0
- package/src/browser/style/tooltip.css +28 -0
- package/src/browser/style/view-container.css +9 -9
- package/src/browser/tooltip-service.tsx +98 -0
- package/src/browser/tree/tree-model.ts +1 -1
- package/src/browser/view-container.ts +312 -80
- package/src/browser/window/default-window-service.ts +1 -1
- package/src/browser/window/window-service.ts +1 -9
- package/src/browser/window-contribution.ts +2 -2
- package/src/common/command.ts +1 -2
- package/src/common/i18n/localization.ts +44 -0
- package/src/common/index.ts +1 -0
- package/src/common/nls.ts +30 -0
- package/src/common/window.ts +30 -0
- package/src/electron-browser/menu/electron-context-menu-renderer.ts +38 -16
- package/src/electron-browser/menu/electron-main-menu-factory.ts +10 -15
- package/src/electron-browser/menu/electron-menu-contribution.ts +129 -39
- package/src/electron-browser/menu/electron-menu-style.css +84 -0
- package/src/electron-browser/window/electron-window-preferences.ts +13 -1
- package/src/electron-browser/window/electron-window-service.ts +1 -1
- package/src/electron-common/electron-main-window-service.ts +1 -2
- package/src/electron-common/messaging/electron-messages.ts +20 -0
- package/src/electron-main/electron-main-application.ts +85 -21
- package/src/electron-main/electron-main-window-service-impl.ts +1 -2
- package/src/electron-main/messaging/electron-messaging-contribution.ts +1 -2
- package/lib/browser/nls.d.ts.map +0 -1
- package/lib/browser/nls.js +0 -64
- package/lib/browser/nls.js.map +0 -1
- package/src/browser/nls.ts +0 -65
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
17
|
import { interfaces } from 'inversify';
|
|
18
|
+
import { nls } from '../../common/nls';
|
|
18
19
|
import { createPreferenceProxy, PreferenceContribution, PreferenceProxy, PreferenceSchema, PreferenceService } from '../../browser/preferences';
|
|
20
|
+
import { isOSX, isWindows } from '../../common';
|
|
19
21
|
|
|
20
22
|
export namespace ZoomLevel {
|
|
21
23
|
export const DEFAULT = 0;
|
|
@@ -36,13 +38,23 @@ export const electronWindowPreferencesSchema: PreferenceSchema = {
|
|
|
36
38
|
'maximum': ZoomLevel.MAX,
|
|
37
39
|
'scope': 'application',
|
|
38
40
|
// eslint-disable-next-line max-len
|
|
39
|
-
'description': 'Adjust the zoom level of the window. The original size is 0 and each increment above (e.g. 1.0) or below (e.g. -1.0) represents zooming 20% larger or smaller. You can also enter decimals to adjust the zoom level with a finer granularity.'
|
|
41
|
+
'description': nls.localize('vscode/desktop.contribution/zoomLevel', 'Adjust the zoom level of the window. The original size is 0 and each increment above (e.g. 1.0) or below (e.g. -1.0) represents zooming 20% larger or smaller. You can also enter decimals to adjust the zoom level with a finer granularity.')
|
|
42
|
+
},
|
|
43
|
+
'window.titleBarStyle': {
|
|
44
|
+
type: 'string',
|
|
45
|
+
enum: ['native', 'custom'],
|
|
46
|
+
default: isWindows ? 'custom' : 'native',
|
|
47
|
+
scope: 'application',
|
|
48
|
+
// eslint-disable-next-line max-len
|
|
49
|
+
description: nls.localize('vscode/desktop.contribution/titleBarStyle', 'Adjust the appearance of the window title bar. On Linux and Windows, this setting also affects the application and context menu appearances. Changes require a full restart to apply.'),
|
|
50
|
+
included: !isOSX
|
|
40
51
|
},
|
|
41
52
|
}
|
|
42
53
|
};
|
|
43
54
|
|
|
44
55
|
export class ElectronWindowConfiguration {
|
|
45
56
|
'window.zoomLevel': number;
|
|
57
|
+
'window.titleBarStyle': 'native' | 'custom';
|
|
46
58
|
}
|
|
47
59
|
|
|
48
60
|
export const ElectronWindowPreferenceContribution = Symbol('ElectronWindowPreferenceContribution');
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import { injectable, inject, postConstruct } from 'inversify';
|
|
18
18
|
import { remote } from '../../../shared/electron';
|
|
19
|
-
import { NewWindowOptions } from '../../
|
|
19
|
+
import { NewWindowOptions } from '../../common/window';
|
|
20
20
|
import { DefaultWindowService } from '../../browser/window/default-window-service';
|
|
21
21
|
import { ElectronMainWindowService } from '../../electron-common/electron-main-window-service';
|
|
22
22
|
import { ElectronWindowPreferences } from './electron-window-preferences';
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
import { NewWindowOptions } from '../browser/window/window-service';
|
|
17
|
+
import { NewWindowOptions } from '../common/window';
|
|
19
18
|
|
|
20
19
|
export const electronMainWindowServicePath = '/services/electron-window';
|
|
21
20
|
export const ElectronMainWindowService = Symbol('ElectronMainWindowService');
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (C) 2021 TypeFox and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
|
|
17
|
+
export const RequestTitleBarStyle = 'requestTitleBarStyle';
|
|
18
|
+
export const TitleBarStyleChanged = 'titleBarStyleChanged';
|
|
19
|
+
export const TitleBarStyleAtStartup = 'titleBarStyleAtStartup';
|
|
20
|
+
export const Restart = 'restart';
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
17
|
import { inject, injectable, named } from 'inversify';
|
|
18
|
-
import { screen, globalShortcut, app, BrowserWindow, BrowserWindowConstructorOptions, Event as ElectronEvent } from '../../shared/electron';
|
|
18
|
+
import { screen, globalShortcut, ipcMain, app, BrowserWindow, BrowserWindowConstructorOptions, Event as ElectronEvent } from '../../shared/electron';
|
|
19
19
|
import * as path from 'path';
|
|
20
20
|
import { Argv } from 'yargs';
|
|
21
21
|
import { AddressInfo } from 'net';
|
|
@@ -30,8 +30,9 @@ import { ContributionProvider } from '../common/contribution-provider';
|
|
|
30
30
|
import { ElectronSecurityTokenService } from './electron-security-token-service';
|
|
31
31
|
import { ElectronSecurityToken } from '../electron-common/electron-token';
|
|
32
32
|
import Storage = require('electron-store');
|
|
33
|
-
|
|
34
|
-
import {
|
|
33
|
+
import { isOSX, isWindows } from '../common';
|
|
34
|
+
import { RequestTitleBarStyle, Restart, TitleBarStyleAtStartup, TitleBarStyleChanged } from '../electron-common/messaging/electron-messages';
|
|
35
|
+
import { DEFAULT_WINDOW_HASH } from '../common/window';
|
|
35
36
|
|
|
36
37
|
const createYargs: (argv?: string[], cwd?: string) => Argv = require('yargs/yargs');
|
|
37
38
|
|
|
@@ -182,6 +183,10 @@ export class ElectronMainApplication {
|
|
|
182
183
|
readonly backendPort = this._backendPort.promise;
|
|
183
184
|
|
|
184
185
|
protected _config: FrontendApplicationConfig | undefined;
|
|
186
|
+
protected useNativeWindowFrame: boolean = true;
|
|
187
|
+
protected didUseNativeWindowFrameOnStart = new Map<number, boolean>();
|
|
188
|
+
protected restarting = false;
|
|
189
|
+
|
|
185
190
|
get config(): FrontendApplicationConfig {
|
|
186
191
|
if (!this._config) {
|
|
187
192
|
throw new Error('You have to start the application first.');
|
|
@@ -190,6 +195,7 @@ export class ElectronMainApplication {
|
|
|
190
195
|
}
|
|
191
196
|
|
|
192
197
|
async start(config: FrontendApplicationConfig): Promise<void> {
|
|
198
|
+
this.useNativeWindowFrame = this.getTitleBarStyle(config) === 'native';
|
|
193
199
|
this._config = config;
|
|
194
200
|
this.hookApplicationEvents();
|
|
195
201
|
const port = await this.startBackend();
|
|
@@ -204,6 +210,23 @@ export class ElectronMainApplication {
|
|
|
204
210
|
});
|
|
205
211
|
}
|
|
206
212
|
|
|
213
|
+
protected getTitleBarStyle(config: FrontendApplicationConfig): 'native' | 'custom' {
|
|
214
|
+
if (isOSX) {
|
|
215
|
+
return 'native';
|
|
216
|
+
}
|
|
217
|
+
const storedFrame = this.electronStore.get('windowstate')?.frame;
|
|
218
|
+
if (storedFrame !== undefined) {
|
|
219
|
+
return !!storedFrame ? 'native' : 'custom';
|
|
220
|
+
}
|
|
221
|
+
if (config.preferences && config.preferences['window.titleBarStyle']) {
|
|
222
|
+
const titleBarStyle = config.preferences['window.titleBarStyle'];
|
|
223
|
+
if (titleBarStyle === 'native' || titleBarStyle === 'custom') {
|
|
224
|
+
return titleBarStyle;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return isWindows ? 'custom' : 'native';
|
|
228
|
+
}
|
|
229
|
+
|
|
207
230
|
protected async launch(params: ElectronMainExecutionParams): Promise<void> {
|
|
208
231
|
createYargs(params.argv, params.cwd)
|
|
209
232
|
.command('$0 [file]', false,
|
|
@@ -233,6 +256,7 @@ export class ElectronMainApplication {
|
|
|
233
256
|
async getLastWindowOptions(): Promise<TheiaBrowserWindowOptions> {
|
|
234
257
|
const windowState: TheiaBrowserWindowOptions | undefined = this.electronStore.get('windowstate') || this.getDefaultTheiaWindowOptions();
|
|
235
258
|
return {
|
|
259
|
+
frame: this.useNativeWindowFrame,
|
|
236
260
|
...windowState,
|
|
237
261
|
...this.getDefaultOptions()
|
|
238
262
|
};
|
|
@@ -327,6 +351,7 @@ export class ElectronMainApplication {
|
|
|
327
351
|
const y = Math.round(bounds.y + (bounds.height - height) / 2);
|
|
328
352
|
const x = Math.round(bounds.x + (bounds.width - width) / 2);
|
|
329
353
|
return {
|
|
354
|
+
frame: this.useNativeWindowFrame,
|
|
330
355
|
isFullScreen: false,
|
|
331
356
|
isMaximized: false,
|
|
332
357
|
width,
|
|
@@ -348,31 +373,41 @@ export class ElectronMainApplication {
|
|
|
348
373
|
* Save the window geometry state on every change.
|
|
349
374
|
*/
|
|
350
375
|
protected attachSaveWindowState(electronWindow: BrowserWindow): void {
|
|
351
|
-
const saveWindowState = () => {
|
|
352
|
-
try {
|
|
353
|
-
const bounds = electronWindow.getBounds();
|
|
354
|
-
this.electronStore.set('windowstate', {
|
|
355
|
-
isFullScreen: electronWindow.isFullScreen(),
|
|
356
|
-
isMaximized: electronWindow.isMaximized(),
|
|
357
|
-
width: bounds.width,
|
|
358
|
-
height: bounds.height,
|
|
359
|
-
x: bounds.x,
|
|
360
|
-
y: bounds.y
|
|
361
|
-
});
|
|
362
|
-
} catch (e) {
|
|
363
|
-
console.error('Error while saving window state:', e);
|
|
364
|
-
}
|
|
365
|
-
};
|
|
366
376
|
let delayedSaveTimeout: NodeJS.Timer | undefined;
|
|
367
377
|
const saveWindowStateDelayed = () => {
|
|
368
378
|
if (delayedSaveTimeout) {
|
|
369
379
|
clearTimeout(delayedSaveTimeout);
|
|
370
380
|
}
|
|
371
|
-
delayedSaveTimeout = setTimeout(saveWindowState, 1000);
|
|
381
|
+
delayedSaveTimeout = setTimeout(() => this.saveWindowState(electronWindow), 1000);
|
|
372
382
|
};
|
|
373
|
-
electronWindow.on('close',
|
|
383
|
+
electronWindow.on('close', () => {
|
|
384
|
+
this.saveWindowState(electronWindow);
|
|
385
|
+
this.didUseNativeWindowFrameOnStart.delete(electronWindow.id);
|
|
386
|
+
});
|
|
374
387
|
electronWindow.on('resize', saveWindowStateDelayed);
|
|
375
388
|
electronWindow.on('move', saveWindowStateDelayed);
|
|
389
|
+
this.didUseNativeWindowFrameOnStart.set(electronWindow.id, this.useNativeWindowFrame);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
protected saveWindowState(electronWindow: BrowserWindow): void {
|
|
393
|
+
// In some circumstances the `electronWindow` can be `null`
|
|
394
|
+
if (!electronWindow) {
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
try {
|
|
398
|
+
const bounds = electronWindow.getBounds();
|
|
399
|
+
this.electronStore.set('windowstate', {
|
|
400
|
+
isFullScreen: electronWindow.isFullScreen(),
|
|
401
|
+
isMaximized: electronWindow.isMaximized(),
|
|
402
|
+
width: bounds.width,
|
|
403
|
+
height: bounds.height,
|
|
404
|
+
x: bounds.x,
|
|
405
|
+
y: bounds.y,
|
|
406
|
+
frame: this.useNativeWindowFrame
|
|
407
|
+
});
|
|
408
|
+
} catch (e) {
|
|
409
|
+
console.error('Error while saving window state:', e);
|
|
410
|
+
}
|
|
376
411
|
}
|
|
377
412
|
|
|
378
413
|
/**
|
|
@@ -477,6 +512,19 @@ export class ElectronMainApplication {
|
|
|
477
512
|
app.on('will-quit', this.onWillQuit.bind(this));
|
|
478
513
|
app.on('second-instance', this.onSecondInstance.bind(this));
|
|
479
514
|
app.on('window-all-closed', this.onWindowAllClosed.bind(this));
|
|
515
|
+
|
|
516
|
+
ipcMain.on(TitleBarStyleChanged, ({ sender }, titleBarStyle: string) => {
|
|
517
|
+
this.useNativeWindowFrame = titleBarStyle === 'native';
|
|
518
|
+
this.saveWindowState(BrowserWindow.fromId(sender.id));
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
ipcMain.on(Restart, ({ sender }) => {
|
|
522
|
+
this.restart(sender.id);
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
ipcMain.on(RequestTitleBarStyle, ({ sender }) => {
|
|
526
|
+
sender.send(TitleBarStyleAtStartup, this.didUseNativeWindowFrameOnStart.get(sender.id) ? 'native' : 'custom');
|
|
527
|
+
});
|
|
480
528
|
}
|
|
481
529
|
|
|
482
530
|
protected onWillQuit(event: ElectronEvent): void {
|
|
@@ -495,7 +543,23 @@ export class ElectronMainApplication {
|
|
|
495
543
|
}
|
|
496
544
|
|
|
497
545
|
protected onWindowAllClosed(event: ElectronEvent): void {
|
|
498
|
-
this.
|
|
546
|
+
if (!this.restarting) {
|
|
547
|
+
this.requestStop();
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
protected restart(id: number): void {
|
|
552
|
+
this.restarting = true;
|
|
553
|
+
const window = BrowserWindow.fromId(id);
|
|
554
|
+
window.on('closed', async () => {
|
|
555
|
+
await this.launch({
|
|
556
|
+
secondInstance: false,
|
|
557
|
+
argv: this.processArgv.getProcessArgvWithoutBin(process.argv),
|
|
558
|
+
cwd: process.cwd()
|
|
559
|
+
});
|
|
560
|
+
this.restarting = false;
|
|
561
|
+
});
|
|
562
|
+
window.close();
|
|
499
563
|
}
|
|
500
564
|
|
|
501
565
|
protected async startContributions(): Promise<void> {
|
|
@@ -18,8 +18,7 @@ import { shell } from '../../shared/electron';
|
|
|
18
18
|
import { injectable, inject } from 'inversify';
|
|
19
19
|
import { ElectronMainWindowService } from '../electron-common/electron-main-window-service';
|
|
20
20
|
import { ElectronMainApplication } from './electron-main-application';
|
|
21
|
-
|
|
22
|
-
import { NewWindowOptions } from '../browser/window/window-service';
|
|
21
|
+
import { NewWindowOptions } from '../common/window';
|
|
23
22
|
|
|
24
23
|
@injectable()
|
|
25
24
|
export class ElectronMainWindowServiceImpl implements ElectronMainWindowService {
|
|
@@ -22,10 +22,9 @@ import { ContributionProvider } from '../../common/contribution-provider';
|
|
|
22
22
|
import { WebSocketChannel } from '../../common/messaging/web-socket-channel';
|
|
23
23
|
import { MessagingContribution } from '../../node/messaging/messaging-contribution';
|
|
24
24
|
import { ConsoleLogger } from '../../node/messaging/logger';
|
|
25
|
-
import { THEIA_ELECTRON_IPC_CHANNEL_NAME } from '../../electron-common/messaging/electron-connection-handler';
|
|
25
|
+
import { ElectronConnectionHandler, THEIA_ELECTRON_IPC_CHANNEL_NAME } from '../../electron-common/messaging/electron-connection-handler';
|
|
26
26
|
import { ElectronMainApplicationContribution } from '../electron-main-application';
|
|
27
27
|
import { ElectronMessagingService } from './electron-messaging-service';
|
|
28
|
-
import { ElectronConnectionHandler } from '../../electron-common/messaging/electron-connection-handler';
|
|
29
28
|
|
|
30
29
|
/**
|
|
31
30
|
* This component replicates the role filled by `MessagingContribution` but for Electron.
|
package/lib/browser/nls.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nls.d.ts","sourceRoot":"","sources":["../../src/browser/nls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAyBlF,yBAAiB,GAAG,CAAC;IAEV,MAAM,QAAQ,aAAa,CAAC;IAE5B,MAAM,MAAM,oBAA+F,CAAC;IAEnH,SAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAUrF;CACJ;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAMtD"}
|
package/lib/browser/nls.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/********************************************************************************
|
|
3
|
-
* Copyright (C) 2021 TypeFox and others.
|
|
4
|
-
*
|
|
5
|
-
* This program and the accompanying materials are made available under the
|
|
6
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
*
|
|
9
|
-
* This Source Code may also be made available under the following Secondary
|
|
10
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
* with the GNU Classpath Exception which is available at
|
|
13
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
*
|
|
15
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
-
********************************************************************************/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.loadTranslations = exports.nls = void 0;
|
|
19
|
-
const endpoint_1 = require("./endpoint");
|
|
20
|
-
let localization;
|
|
21
|
-
function format(message, args) {
|
|
22
|
-
let result = message;
|
|
23
|
-
if (args.length > 0) {
|
|
24
|
-
result = message.replace(/\{(\d+)\}/g, (match, rest) => {
|
|
25
|
-
const index = rest[0];
|
|
26
|
-
const arg = args[index];
|
|
27
|
-
let replacement = match;
|
|
28
|
-
if (typeof arg === 'string') {
|
|
29
|
-
replacement = arg;
|
|
30
|
-
}
|
|
31
|
-
else if (typeof arg === 'number' || typeof arg === 'boolean' || !arg) {
|
|
32
|
-
replacement = String(arg);
|
|
33
|
-
}
|
|
34
|
-
return replacement;
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
return result;
|
|
38
|
-
}
|
|
39
|
-
var nls;
|
|
40
|
-
(function (nls) {
|
|
41
|
-
nls.localeId = 'localeId';
|
|
42
|
-
nls.locale = typeof window === 'object' && window && window.localStorage.getItem('localeId') || undefined;
|
|
43
|
-
function localize(key, defaultValue, ...args) {
|
|
44
|
-
let value = defaultValue;
|
|
45
|
-
if (localization) {
|
|
46
|
-
const translation = localization.translations[key];
|
|
47
|
-
if (translation) {
|
|
48
|
-
// vscode's localizations often contain additional '&&' symbols, which we simply ignore
|
|
49
|
-
value = translation.replace(/&&/g, '');
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return format(value, args);
|
|
53
|
-
}
|
|
54
|
-
nls.localize = localize;
|
|
55
|
-
})(nls = exports.nls || (exports.nls = {}));
|
|
56
|
-
async function loadTranslations() {
|
|
57
|
-
if (nls.locale) {
|
|
58
|
-
const endpoint = new endpoint_1.Endpoint({ path: '/i18n/' + nls.locale }).getRestUrl().toString();
|
|
59
|
-
const response = await fetch(endpoint);
|
|
60
|
-
localization = await response.json();
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
exports.loadTranslations = loadTranslations;
|
|
64
|
-
//# sourceMappingURL=nls.js.map
|
package/lib/browser/nls.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nls.js","sourceRoot":"","sources":["../../src/browser/nls.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAGlF,yCAAsC;AAEtC,IAAI,YAAsC,CAAC;AAE3C,SAAS,MAAM,CAAC,OAAe,EAAE,IAAc;IAC3C,IAAI,MAAM,GAAG,OAAO,CAAC;IACrB,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;QACjB,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YACnD,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YACtB,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;YACxB,IAAI,WAAW,GAAG,KAAK,CAAC;YACxB,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;gBACzB,WAAW,GAAG,GAAG,CAAC;aACrB;iBAAM,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,KAAK,SAAS,IAAI,CAAC,GAAG,EAAE;gBACpE,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;aAC7B;YACD,OAAO,WAAW,CAAC;QACvB,CAAC,CAAC,CAAC;KACN;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,IAAiB,GAAG,CAiBnB;AAjBD,WAAiB,GAAG;IAEH,YAAQ,GAAG,UAAU,CAAC;IAEtB,UAAM,GAAG,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,SAAS,CAAC;IAEnH,SAAgB,QAAQ,CAAC,GAAW,EAAE,YAAoB,EAAE,GAAG,IAAc;QACzE,IAAI,KAAK,GAAG,YAAY,CAAC;QACzB,IAAI,YAAY,EAAE;YACd,MAAM,WAAW,GAAG,YAAY,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;YACnD,IAAI,WAAW,EAAE;gBACb,uFAAuF;gBACvF,KAAK,GAAG,WAAW,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;aAC1C;SACJ;QACD,OAAO,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC/B,CAAC;IAVe,YAAQ,WAUvB,CAAA;AACL,CAAC,EAjBgB,GAAG,GAAH,WAAG,KAAH,WAAG,QAiBnB;AAEM,KAAK,UAAU,gBAAgB;IAClC,IAAI,GAAG,CAAC,MAAM,EAAE;QACZ,MAAM,QAAQ,GAAG,IAAI,mBAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,CAAC;QACvF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAC,CAAC;QACvC,YAAY,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;KACxC;AACL,CAAC;AAND,4CAMC"}
|
package/src/browser/nls.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (C) 2021 TypeFox and others.
|
|
3
|
-
*
|
|
4
|
-
* This program and the accompanying materials are made available under the
|
|
5
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
*
|
|
8
|
-
* This Source Code may also be made available under the following Secondary
|
|
9
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
* with the GNU Classpath Exception which is available at
|
|
12
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
*
|
|
14
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
-
********************************************************************************/
|
|
16
|
-
|
|
17
|
-
import { Localization } from '../common/i18n/localization';
|
|
18
|
-
import { Endpoint } from './endpoint';
|
|
19
|
-
|
|
20
|
-
let localization: Localization | undefined;
|
|
21
|
-
|
|
22
|
-
function format(message: string, args: string[]): string {
|
|
23
|
-
let result = message;
|
|
24
|
-
if (args.length > 0) {
|
|
25
|
-
result = message.replace(/\{(\d+)\}/g, (match, rest) => {
|
|
26
|
-
const index = rest[0];
|
|
27
|
-
const arg = args[index];
|
|
28
|
-
let replacement = match;
|
|
29
|
-
if (typeof arg === 'string') {
|
|
30
|
-
replacement = arg;
|
|
31
|
-
} else if (typeof arg === 'number' || typeof arg === 'boolean' || !arg) {
|
|
32
|
-
replacement = String(arg);
|
|
33
|
-
}
|
|
34
|
-
return replacement;
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
return result;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export namespace nls {
|
|
41
|
-
|
|
42
|
-
export const localeId = 'localeId';
|
|
43
|
-
|
|
44
|
-
export const locale = typeof window === 'object' && window && window.localStorage.getItem('localeId') || undefined;
|
|
45
|
-
|
|
46
|
-
export function localize(key: string, defaultValue: string, ...args: string[]): string {
|
|
47
|
-
let value = defaultValue;
|
|
48
|
-
if (localization) {
|
|
49
|
-
const translation = localization.translations[key];
|
|
50
|
-
if (translation) {
|
|
51
|
-
// vscode's localizations often contain additional '&&' symbols, which we simply ignore
|
|
52
|
-
value = translation.replace(/&&/g, '');
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return format(value, args);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export async function loadTranslations(): Promise<void> {
|
|
60
|
-
if (nls.locale) {
|
|
61
|
-
const endpoint = new Endpoint({ path: '/i18n/' + nls.locale }).getRestUrl().toString();
|
|
62
|
-
const response = await fetch(endpoint);
|
|
63
|
-
localization = await response.json();
|
|
64
|
-
}
|
|
65
|
-
}
|