mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-03 21:25:13 +00:00
Arguments for Chromium in an Electron.NET app #764
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ToniTurek on GitHub (Feb 18, 2022).
I am running Windows 10 on an iMac with screen scaling. Chromium has issues with that scaling which results in low FPS (around 15). I also see this low FPS when I run my Electron.NET app. When I start chromium with the arguments "--high-dpi-support=1" and "--force-device-scale-factor=1" it runs much better.
How can I enable these chromium arguments in my Electron.NET app?
@danatcofo commented on GitHub (Feb 18, 2022):
This stackoverflow question might give you some way to do this.
https://stackoverflow.com/questions/57900207/how-to-avoid-windows-zoom-in-electron-app
Basically it's recommending that you append the switches to the command arguments in the main process. I imagine you could do this inside the host hook as well.
@ToniTurek commented on GitHub (Feb 18, 2022):
Hi @danatcofo
Thanks for your reply!
Acctualy, I tried to set these switches via:
but this has unfortunatelly no effect.
Does anyone an idea how to pass these arguments to Chromium in Electron.NET?
@danatcofo commented on GitHub (Feb 18, 2022):
Do it in the host hook js, I believe the .net properties are read only their and won't affect electron.
Remember this is a combo of electron & .net, sometimes you need to get down to the electron.
@ToniTurek commented on GitHub (Feb 18, 2022):
I created a ElectronHostHook using the
electronize add hosthook
command. This has created an ElectronHostHook folder with an index.js and a package.json file in it. The index.js looks like this:
but I don't know where to add the
lines. Any hint?
@danatcofo commented on GitHub (Feb 18, 2022):
https://www.electronjs.org/docs/latest/api/app
const { app } = require('electron');
Or something similar
Or in your case given the snippet posted
Const app = Electron.app
@ToniTurek commented on GitHub (Feb 19, 2022):
This is how my
index.tsin the ElectronHostHook folder now looks like:But nothing has changed. Not even the console.log output can be seen in the terminal although I see that the ElectronHostHook is executed:

I think its all about customizing the
main.jswhich for Electron.NET is created automatically from theelectron.manifest.json.I also tried to explicitely specify a main.js with the electron.manifest.json command:
"main": "my_main.js", but this is not working as well.I'm really lost how to solve this issue...
@danatcofo commented on GitHub (Feb 19, 2022):
Honestly I'm just googling ideas here.
https://www.geeksforgeeks.org/command-line-arguments-in-electronjs/amp/
You could do the same. But this is an electron issue at its heart. Sorry trying to help.