Skip to content

Conversation

@oxiez
Copy link

@oxiez oxiez commented Mar 3, 2020

Fixes #80. Changing the callback on webContents for dom-ready to this:

webContents.on('dom-ready', () => {
    const stylesheets = fs.readdirSync(file.style);
    stylesheets.forEach(x => webContents.insertCSS(readSheet(x)));

   console.log("dom-ready");
    if (settings.get('launchMinimized')) {
      mainWindow.minimize();
    } else {
      mainWindow.show();
    }
  });

outputs the following on npm start:

> electron .

dom-ready
dom-ready
dom-ready
dom-ready
dom-ready
dom-ready

I believe repeated dom-ready fires was the reason for the window repeatedly stealing focus on startup. The window should now load in the background if clicked away from.

Using ready-to-show might also be an option, if the version of electron is updated:
electron/electron#7779

@825i
Copy link

825i commented Oct 8, 2020

Pushed to my own branch. Thanks. Added your name in the credits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ao on macos brings itself to front multiple times on startup

2 participants