-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable clients to change electron windowOptions either by using the "…
…set-window-options" IPC-Event or by specifying the windowOptions inside package.json under theia/frontend/config/electron/windowOptions". Move "disallowReloadKeybinding" to the aforementioned "electron" object. Signed-off-by: Luca Jaeger <[email protected]>
- Loading branch information
1 parent
244f34f
commit 82cc44c
Showing
3 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,7 +139,9 @@ const { ElectronSecurityToken } = require('@theia/core/lib/electron-common/elect | |
const applicationName = \`${this.pck.props.frontend.config.applicationName}\`; | ||
const isSingleInstance = ${this.pck.props.backend.config.singleInstance === true ? 'true' : 'false'}; | ||
const disallowReloadKeybinding = ${this.pck.props.frontend.config.disallowReloadKeybinding === true ? 'true' : 'false'}; | ||
const disallowReloadKeybinding = ${this.pck.props.frontend.config.electron?.disallowReloadKeybinding === true ? 'true' : 'false'}; | ||
const defaultWindowOptionsAdditions = ${this.prettyStringify(this.pck.props.frontend.config.electron?.windowOptions || {})}; | ||
if (isSingleInstance && !app.requestSingleInstanceLock()) { | ||
// There is another instance running, exit now. The other instance will request focus. | ||
|
@@ -184,6 +186,13 @@ app.on('ready', () => { | |
width, height, x, y | ||
}); | ||
const persistedWindowOptionsAdditions = electronStore.get('windowOptions'); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
kittaakos
Contributor
|
||
const windowOptionsAdditions = { | ||
...defaultWindowOptionsAdditions, | ||
...persistedWindowOptionsAdditions | ||
}; | ||
let windowOptions = { | ||
show: false, | ||
title: applicationName, | ||
|
@@ -193,7 +202,8 @@ app.on('ready', () => { | |
minHeight: 120, | ||
x: windowState.x, | ||
y: windowState.y, | ||
isMaximized: windowState.isMaximized | ||
isMaximized: windowState.isMaximized, | ||
...windowOptionsAdditions | ||
}; | ||
// Always hide the window, we will show the window when it is ready to be shown in any case. | ||
|
@@ -291,6 +301,12 @@ app.on('ready', () => { | |
ipcMain.on('open-external', (event, url) => { | ||
shell.openExternal(url); | ||
}); | ||
ipcMain.on('set-window-options', (event, options) => { | ||
electronStore.set('windowOptions', options); | ||
}); | ||
ipcMain.on('get-persisted-window-options-additions', event => { | ||
event.returnValue = electronStore.get('windowOptions'); | ||
}); | ||
// Check whether we are in bundled application or development mode. | ||
// @ts-ignore | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is strange, I have just pulled from
master
(8bb713f) and I can see errors in the generated theelectron-main.js
.Store
(fromelectron-store
) is a subclass ofConf
(fromconf
), which has the followingget
API:@owlJaeger, can you please fix the generator so that it does not produce code with errors?
CC: @vince-fugnitto