@theia/core 1.18.0 → 1.21.0-next.12
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/color-registry.d.ts +3 -69
- package/lib/browser/color-registry.d.ts.map +1 -1
- package/lib/browser/color-registry.js +13 -27
- package/lib/browser/color-registry.js.map +1 -1
- package/lib/browser/common-frontend-contribution.d.ts +7 -13
- package/lib/browser/common-frontend-contribution.d.ts.map +1 -1
- package/lib/browser/common-frontend-contribution.js +213 -250
- 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 +29 -19
- 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 +9 -5
- 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/keyboard/browser-keyboard-layout-provider.d.ts +1 -1
- package/lib/browser/keyboard/browser-keyboard-layout-provider.d.ts.map +1 -1
- package/lib/browser/keyboard/browser-keyboard-layout-provider.spec.js +6 -4
- package/lib/browser/keyboard/browser-keyboard-layout-provider.spec.js.map +1 -1
- package/lib/browser/keyboard/keys.d.ts +2 -251
- package/lib/browser/keyboard/keys.d.ts.map +1 -1
- package/lib/browser/keyboard/keys.js +12 -614
- package/lib/browser/keyboard/keys.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/messaging/ws-connection-provider.d.ts +3 -3
- package/lib/browser/messaging/ws-connection-provider.d.ts.map +1 -1
- package/lib/browser/messaging/ws-connection-provider.js +14 -4
- package/lib/browser/messaging/ws-connection-provider.js.map +1 -1
- package/lib/browser/{nls.d.ts → nls-loader.d.ts} +1 -6
- 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/preferences/preference-provider.d.ts +0 -2
- package/lib/browser/preferences/preference-provider.d.ts.map +1 -1
- package/lib/browser/preferences/preference-provider.js +1 -5
- package/lib/browser/preferences/preference-provider.js.map +1 -1
- package/lib/browser/preferences/preference-service.spec.js +0 -3
- package/lib/browser/preferences/preference-service.spec.js.map +1 -1
- 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-input-service.d.ts +1 -201
- package/lib/browser/quick-input/quick-input-service.d.ts.map +1 -1
- package/lib/browser/quick-input/quick-input-service.js +11 -93
- package/lib/browser/quick-input/quick-input-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 +10 -8
- package/lib/browser/shell/application-shell.d.ts.map +1 -1
- package/lib/browser/shell/application-shell.js +11 -19
- package/lib/browser/shell/application-shell.js.map +1 -1
- package/lib/browser/shell/current-widget-command-adapter.d.ts +39 -0
- package/lib/browser/shell/current-widget-command-adapter.d.ts.map +1 -0
- package/lib/browser/shell/current-widget-command-adapter.js +42 -0
- package/lib/browser/shell/current-widget-command-adapter.js.map +1 -0
- 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 +22 -3
- package/lib/browser/shell/tab-bars.d.ts.map +1 -1
- package/lib/browser/shell/tab-bars.js +129 -10
- package/lib/browser/shell/tab-bars.js.map +1 -1
- package/lib/browser/storage-service.spec.js +1 -1
- package/lib/browser/storage-service.spec.js.map +1 -1
- package/lib/browser/theming.d.ts +5 -14
- package/lib/browser/theming.d.ts.map +1 -1
- package/lib/browser/theming.js +14 -0
- package/lib/browser/theming.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/color.d.ts +84 -0
- package/lib/common/color.d.ts.map +1 -0
- package/lib/common/color.js +44 -0
- package/lib/common/color.js.map +1 -0
- package/lib/common/command.d.ts +1 -0
- package/lib/common/command.d.ts.map +1 -1
- package/lib/common/command.js +5 -2
- package/lib/common/command.js.map +1 -1
- package/lib/common/i18n/localization.d.ts +14 -0
- package/lib/common/i18n/localization.d.ts.map +1 -1
- package/lib/common/i18n/localization.js +54 -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/common/keys.d.ts +269 -0
- package/lib/common/keys.d.ts.map +1 -0
- package/lib/common/keys.js +634 -0
- package/lib/common/keys.js.map +1 -0
- package/lib/common/messaging/abstract-connection-provider.d.ts +1 -1
- package/lib/common/messaging/abstract-connection-provider.d.ts.map +1 -1
- package/lib/common/messaging/abstract-connection-provider.js +3 -1
- package/lib/common/messaging/abstract-connection-provider.js.map +1 -1
- package/lib/common/messaging/proxy-factory.js +1 -1
- package/lib/common/messaging/proxy-factory.js.map +1 -1
- package/lib/common/nls.d.ts +28 -0
- package/lib/common/nls.d.ts.map +1 -0
- package/lib/common/nls.js +91 -0
- package/lib/common/nls.js.map +1 -0
- package/lib/common/path.d.ts +6 -0
- package/lib/common/path.d.ts.map +1 -1
- package/lib/common/path.js +16 -4
- package/lib/common/path.js.map +1 -1
- package/lib/common/path.spec.js +12 -0
- package/lib/common/path.spec.js.map +1 -1
- package/lib/common/promise-util.d.ts +5 -2
- package/lib/common/promise-util.d.ts.map +1 -1
- package/lib/common/promise-util.js +16 -1
- package/lib/common/promise-util.js.map +1 -1
- package/lib/common/promise-util.spec.d.ts +2 -0
- package/lib/common/promise-util.spec.d.ts.map +1 -0
- package/lib/common/promise-util.spec.js +42 -0
- package/lib/common/promise-util.spec.js.map +1 -0
- package/lib/common/quick-pick-service.d.ts +219 -1
- package/lib/common/quick-pick-service.d.ts.map +1 -1
- package/lib/common/quick-pick-service.js +108 -1
- package/lib/common/quick-pick-service.js.map +1 -1
- package/lib/common/theme.d.ts +30 -0
- package/lib/common/theme.d.ts.map +1 -0
- package/lib/common/theme.js +18 -0
- package/lib/common/theme.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 +16 -0
- package/lib/electron-main/electron-main-application.d.ts.map +1 -1
- package/lib/electron-main/electron-main-application.js +91 -25
- 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 +7 -5
- 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/color-registry.ts +3 -85
- package/src/browser/common-frontend-contribution.ts +179 -232
- package/src/browser/core-preferences.ts +32 -19
- package/src/browser/dialogs.ts +10 -3
- package/src/browser/frontend-application-module.ts +10 -5
- 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/keyboard/browser-keyboard-layout-provider.spec.ts +10 -4
- package/src/browser/keyboard/keys.ts +2 -675
- package/src/browser/menu/browser-context-menu-renderer.ts +1 -1
- package/src/browser/menu/browser-menu-plugin.ts +25 -5
- package/src/browser/messaging/ws-connection-provider.ts +13 -4
- package/src/browser/nls-loader.ts +26 -0
- package/src/browser/preferences/preference-provider.ts +1 -5
- package/src/browser/preferences/preference-service.spec.ts +0 -3
- 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-input-service.ts +1 -278
- package/src/browser/quick-input/quick-view-service.ts +1 -2
- package/src/browser/shell/application-shell.ts +21 -25
- package/src/browser/shell/current-widget-command-adapter.ts +57 -0
- 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 +133 -13
- package/src/browser/storage-service.spec.ts +1 -1
- 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/theming.ts +6 -17
- 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 +2 -2
- package/src/browser/window/window-service.ts +1 -9
- package/src/browser/window-contribution.ts +2 -2
- package/src/common/color.ts +100 -0
- package/src/common/command.ts +11 -2
- package/src/common/i18n/localization.ts +54 -0
- package/src/common/i18n/nls.metadata.json +20421 -0
- package/src/common/index.ts +1 -0
- package/src/common/keys.ts +693 -0
- package/src/common/messaging/abstract-connection-provider.ts +3 -1
- package/src/common/messaging/proxy-factory.ts +1 -1
- package/src/common/nls.ts +104 -0
- package/src/common/path.spec.ts +15 -0
- package/src/common/path.ts +16 -4
- package/src/common/promise-util.spec.ts +41 -0
- package/src/common/promise-util.ts +23 -4
- package/src/common/quick-pick-service.ts +299 -4
- package/src/common/theme.ts +32 -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 +107 -24
- 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,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
|
|
|
@@ -41,6 +42,12 @@ const createYargs: (argv?: string[], cwd?: string) => Argv = require('yargs/yarg
|
|
|
41
42
|
export interface TheiaBrowserWindowOptions extends BrowserWindowConstructorOptions {
|
|
42
43
|
isMaximized?: boolean;
|
|
43
44
|
isFullScreen?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Represents the complete screen layout for all available displays.
|
|
47
|
+
* This field is used to determine if the layout was updated since the electron window was last opened,
|
|
48
|
+
* in which case we want to invalidate the stored options and use the default options instead.
|
|
49
|
+
*/
|
|
50
|
+
screenLayout?: string;
|
|
44
51
|
}
|
|
45
52
|
|
|
46
53
|
/**
|
|
@@ -182,6 +189,10 @@ export class ElectronMainApplication {
|
|
|
182
189
|
readonly backendPort = this._backendPort.promise;
|
|
183
190
|
|
|
184
191
|
protected _config: FrontendApplicationConfig | undefined;
|
|
192
|
+
protected useNativeWindowFrame: boolean = true;
|
|
193
|
+
protected didUseNativeWindowFrameOnStart = new Map<number, boolean>();
|
|
194
|
+
protected restarting = false;
|
|
195
|
+
|
|
185
196
|
get config(): FrontendApplicationConfig {
|
|
186
197
|
if (!this._config) {
|
|
187
198
|
throw new Error('You have to start the application first.');
|
|
@@ -190,6 +201,7 @@ export class ElectronMainApplication {
|
|
|
190
201
|
}
|
|
191
202
|
|
|
192
203
|
async start(config: FrontendApplicationConfig): Promise<void> {
|
|
204
|
+
this.useNativeWindowFrame = this.getTitleBarStyle(config) === 'native';
|
|
193
205
|
this._config = config;
|
|
194
206
|
this.hookApplicationEvents();
|
|
195
207
|
const port = await this.startBackend();
|
|
@@ -204,6 +216,23 @@ export class ElectronMainApplication {
|
|
|
204
216
|
});
|
|
205
217
|
}
|
|
206
218
|
|
|
219
|
+
protected getTitleBarStyle(config: FrontendApplicationConfig): 'native' | 'custom' {
|
|
220
|
+
if (isOSX) {
|
|
221
|
+
return 'native';
|
|
222
|
+
}
|
|
223
|
+
const storedFrame = this.electronStore.get('windowstate')?.frame;
|
|
224
|
+
if (storedFrame !== undefined) {
|
|
225
|
+
return !!storedFrame ? 'native' : 'custom';
|
|
226
|
+
}
|
|
227
|
+
if (config.preferences && config.preferences['window.titleBarStyle']) {
|
|
228
|
+
const titleBarStyle = config.preferences['window.titleBarStyle'];
|
|
229
|
+
if (titleBarStyle === 'native' || titleBarStyle === 'custom') {
|
|
230
|
+
return titleBarStyle;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return isWindows ? 'custom' : 'native';
|
|
234
|
+
}
|
|
235
|
+
|
|
207
236
|
protected async launch(params: ElectronMainExecutionParams): Promise<void> {
|
|
208
237
|
createYargs(params.argv, params.cwd)
|
|
209
238
|
.command('$0 [file]', false,
|
|
@@ -231,10 +260,14 @@ export class ElectronMainApplication {
|
|
|
231
260
|
}
|
|
232
261
|
|
|
233
262
|
async getLastWindowOptions(): Promise<TheiaBrowserWindowOptions> {
|
|
234
|
-
const
|
|
263
|
+
const previousWindowState: TheiaBrowserWindowOptions | undefined = this.electronStore.get('windowstate');
|
|
264
|
+
const windowState = previousWindowState?.screenLayout === this.getCurrentScreenLayout()
|
|
265
|
+
? previousWindowState
|
|
266
|
+
: this.getDefaultTheiaWindowOptions();
|
|
235
267
|
return {
|
|
236
|
-
|
|
237
|
-
...this.getDefaultOptions()
|
|
268
|
+
frame: this.useNativeWindowFrame,
|
|
269
|
+
...this.getDefaultOptions(),
|
|
270
|
+
...windowState
|
|
238
271
|
};
|
|
239
272
|
}
|
|
240
273
|
|
|
@@ -327,6 +360,7 @@ export class ElectronMainApplication {
|
|
|
327
360
|
const y = Math.round(bounds.y + (bounds.height - height) / 2);
|
|
328
361
|
const x = Math.round(bounds.x + (bounds.width - width) / 2);
|
|
329
362
|
return {
|
|
363
|
+
frame: this.useNativeWindowFrame,
|
|
330
364
|
isFullScreen: false,
|
|
331
365
|
isMaximized: false,
|
|
332
366
|
width,
|
|
@@ -348,31 +382,51 @@ export class ElectronMainApplication {
|
|
|
348
382
|
* Save the window geometry state on every change.
|
|
349
383
|
*/
|
|
350
384
|
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
385
|
let delayedSaveTimeout: NodeJS.Timer | undefined;
|
|
367
386
|
const saveWindowStateDelayed = () => {
|
|
368
387
|
if (delayedSaveTimeout) {
|
|
369
388
|
clearTimeout(delayedSaveTimeout);
|
|
370
389
|
}
|
|
371
|
-
delayedSaveTimeout = setTimeout(saveWindowState, 1000);
|
|
390
|
+
delayedSaveTimeout = setTimeout(() => this.saveWindowState(electronWindow), 1000);
|
|
372
391
|
};
|
|
373
|
-
electronWindow.on('close',
|
|
392
|
+
electronWindow.on('close', () => {
|
|
393
|
+
this.saveWindowState(electronWindow);
|
|
394
|
+
this.didUseNativeWindowFrameOnStart.delete(electronWindow.id);
|
|
395
|
+
});
|
|
374
396
|
electronWindow.on('resize', saveWindowStateDelayed);
|
|
375
397
|
electronWindow.on('move', saveWindowStateDelayed);
|
|
398
|
+
this.didUseNativeWindowFrameOnStart.set(electronWindow.id, this.useNativeWindowFrame);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
protected saveWindowState(electronWindow: BrowserWindow): void {
|
|
402
|
+
// In some circumstances the `electronWindow` can be `null`
|
|
403
|
+
if (!electronWindow) {
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
try {
|
|
407
|
+
const bounds = electronWindow.getBounds();
|
|
408
|
+
this.electronStore.set('windowstate', {
|
|
409
|
+
isFullScreen: electronWindow.isFullScreen(),
|
|
410
|
+
isMaximized: electronWindow.isMaximized(),
|
|
411
|
+
width: bounds.width,
|
|
412
|
+
height: bounds.height,
|
|
413
|
+
x: bounds.x,
|
|
414
|
+
y: bounds.y,
|
|
415
|
+
frame: this.useNativeWindowFrame,
|
|
416
|
+
screenLayout: this.getCurrentScreenLayout(),
|
|
417
|
+
} as TheiaBrowserWindowOptions);
|
|
418
|
+
} catch (e) {
|
|
419
|
+
console.error('Error while saving window state:', e);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Return a string unique to the current display layout.
|
|
425
|
+
*/
|
|
426
|
+
protected getCurrentScreenLayout(): string {
|
|
427
|
+
return screen.getAllDisplays().map(
|
|
428
|
+
display => `${display.bounds.x}:${display.bounds.y}:${display.bounds.width}:${display.bounds.height}`
|
|
429
|
+
).sort().join('-');
|
|
376
430
|
}
|
|
377
431
|
|
|
378
432
|
/**
|
|
@@ -477,6 +531,19 @@ export class ElectronMainApplication {
|
|
|
477
531
|
app.on('will-quit', this.onWillQuit.bind(this));
|
|
478
532
|
app.on('second-instance', this.onSecondInstance.bind(this));
|
|
479
533
|
app.on('window-all-closed', this.onWindowAllClosed.bind(this));
|
|
534
|
+
|
|
535
|
+
ipcMain.on(TitleBarStyleChanged, ({ sender }, titleBarStyle: string) => {
|
|
536
|
+
this.useNativeWindowFrame = titleBarStyle === 'native';
|
|
537
|
+
this.saveWindowState(BrowserWindow.fromId(sender.id));
|
|
538
|
+
});
|
|
539
|
+
|
|
540
|
+
ipcMain.on(Restart, ({ sender }) => {
|
|
541
|
+
this.restart(sender.id);
|
|
542
|
+
});
|
|
543
|
+
|
|
544
|
+
ipcMain.on(RequestTitleBarStyle, ({ sender }) => {
|
|
545
|
+
sender.send(TitleBarStyleAtStartup, this.didUseNativeWindowFrameOnStart.get(sender.id) ? 'native' : 'custom');
|
|
546
|
+
});
|
|
480
547
|
}
|
|
481
548
|
|
|
482
549
|
protected onWillQuit(event: ElectronEvent): void {
|
|
@@ -495,7 +562,23 @@ export class ElectronMainApplication {
|
|
|
495
562
|
}
|
|
496
563
|
|
|
497
564
|
protected onWindowAllClosed(event: ElectronEvent): void {
|
|
498
|
-
this.
|
|
565
|
+
if (!this.restarting) {
|
|
566
|
+
this.requestStop();
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
protected restart(id: number): void {
|
|
571
|
+
this.restarting = true;
|
|
572
|
+
const window = BrowserWindow.fromId(id);
|
|
573
|
+
window.on('closed', async () => {
|
|
574
|
+
await this.launch({
|
|
575
|
+
secondInstance: false,
|
|
576
|
+
argv: this.processArgv.getProcessArgvWithoutBin(process.argv),
|
|
577
|
+
cwd: process.cwd()
|
|
578
|
+
});
|
|
579
|
+
this.restarting = false;
|
|
580
|
+
});
|
|
581
|
+
window.close();
|
|
499
582
|
}
|
|
500
583
|
|
|
501
584
|
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
|
-
}
|