lime icon indicating copy to clipboard operation
lime copied to clipboard

[ENHANCEMENT] Add ability to specify additional ElectronBrowserWindow configuration

Open EliteMasterEric opened this issue 2 years ago • 4 comments

As it stands, the configuration for the ElectronBrowserWindow created by lime in ElectronSetup cannot provide certain additional parameters needed by the user.

Notably, additional webPreferences cannot be overridden, meaning that options like contextIsolation: false cannot be provided without modifying lime.

https://github.com/haxelime/lime/blob/c743fe10c404fb73003e24100f319a472cb4203f/templates/electron/haxe/ElectronSetup.hx#L54

An option to provide this, either by a command line option or by a project config, would be useful.

EliteMasterEric avatar Nov 17 '21 05:11 EliteMasterEric

CC @TamarCurry has been experiencing issues related to this.

EliteMasterEric avatar Nov 17 '21 05:11 EliteMasterEric

Is there any reason you can't use the template feature? Copy ElectronSetup.hx into your project, make the changes you need, and then tell Lime to use your copy:

<template path="my/copy/of/ElectronSetup.hx" rename="haxe/ElectronSetup.hx" />

(Disclaimer: I don't know if the destination path is correct. Check your Export/electron folder to figure out where it really goes.)

player-03 avatar Nov 17 '21 08:11 player-03

Using templates to replace a file might be a solution. However, ElectronSetup.hx already checks compiler values for things like allowHighDPI and stencilBuffer when it sets up the array for windows in lines 12 through 36, so I figure it could at least support compiler values for things like contextIsolation and other properties for the webPreferences properties as well. A comprehensive list of the webPreferences properties can be found here.

TamarCurry avatar Nov 17 '21 15:11 TamarCurry

Is there any reason you can't use the template feature?

This is a very interesting feature. Does this allow you to essentially hotpatch any of your project's dependencies?

I'll look into using it as a fix for my particular use case.

EliteMasterEric avatar Nov 17 '21 15:11 EliteMasterEric