mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-09-22 06:54:44 +00:00
Add way to set flags for Electron before the app starts
This commit is contained in:
@@ -539,9 +539,9 @@ namespace ElectronNET.API
|
||||
public Task<string> GetNameAsync() => BridgeConnector.OnResult<string>("appGetName", "appGetNameCompleted");
|
||||
|
||||
|
||||
internal App()
|
||||
private App()
|
||||
{
|
||||
CommandLine = new CommandLine();
|
||||
CommandLine = CommandLine.Instance;
|
||||
}
|
||||
|
||||
internal static App Instance
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public sealed class CommandLine
|
||||
{
|
||||
internal CommandLine() { }
|
||||
private CommandLine() { }
|
||||
|
||||
internal static CommandLine Instance
|
||||
{
|
||||
|
||||
@@ -28,4 +28,10 @@ namespace ElectronNET.API.Entities
|
||||
/// </summary>
|
||||
customButtonsOnHover
|
||||
}
|
||||
|
||||
public class TitleBarOverlayConfig
|
||||
{
|
||||
public string Color { get; set; }
|
||||
public string SymbolColor { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -171,6 +171,12 @@ namespace ElectronNET.API.Entities
|
||||
/// </summary>
|
||||
public bool Offscreen { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether to enable built-in spellcheck
|
||||
/// </summary>
|
||||
[DefaultValue(true)]
|
||||
public bool Spellcheck { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to run Electron APIs and the specified preload script in a separate
|
||||
/// JavaScript context. Defaults to false. The context that the preload script runs
|
||||
|
||||
@@ -54,6 +54,7 @@ app.on('before-quit-for-update', () => {
|
||||
});
|
||||
|
||||
const manifestJsonFile = require(manifestJsonFilePath);
|
||||
|
||||
if (manifestJsonFile.singleInstance || manifestJsonFile.aspCoreBackendPort) {
|
||||
const mainInstance = app.requestSingleInstanceLock();
|
||||
app.on('second-instance', (events, args = []) => {
|
||||
@@ -81,6 +82,14 @@ if (manifestJsonFile.singleInstance || manifestJsonFile.aspCoreBackendPort) {
|
||||
}
|
||||
}
|
||||
|
||||
//Some flags need to be set before app is ready
|
||||
if (manifestJsonFile.hasOwnProperty('cliFlags') && manifesJsonFile.cliFlags.length > 0) {
|
||||
manifestJsonFile.cliFlags.forEach(flag => {
|
||||
app.commandLine.appendSwitch(flag);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
app.on('ready', () => {
|
||||
|
||||
// Fix ERR_UNKNOWN_URL_SCHEME using file protocol
|
||||
|
||||
Reference in New Issue
Block a user