Skip to content

Fixes #80: Check if already shown on dom-ready #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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