Skip to content
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

How to handle the hidden in MacOS? #81

Open
weiluenju opened this issue Apr 18, 2018 · 3 comments
Open

How to handle the hidden in MacOS? #81

weiluenju opened this issue Apr 18, 2018 · 3 comments

Comments

@weiluenju
Copy link

  • The target platform(s) the problem occurs on (Linux, Mac, Mac App Store, and or Windows): Mac
  • Node version (run node -v): 8.10
  • auto-launch version: 5.0.5
  • The options you're passing to auto-launch:
  • Are you using NW.js or Electron? NW.js
    • If so, which version? 0.30.0
    • If you're using Electron, are you using auto-launch from the main process or a renderer process?
  • Can you reproduce this with a simple Hello World example app?
  • If needs be, would you be able to provide us with a simple app (as simple as possible) which reproduces the problem?

Now my program can auto start, but the window still show after login, even I already set isHidden to true.

I try to see the nw.App.argv array, but not found any about hidden information.

How can I do to handle the hidden in MacOS?

Thanks.

@weiluenju
Copy link
Author

weiluenju commented Apr 18, 2018

OK, I give up using the AppleScript,

I change to use the Launch Agent, but I found if i don't assign the path, the path in plist file will be

.../ABC.app/Contents/Versions/66.0.3359.117/nwjs Helper.app/Contents/MacOS/nwjs Helper

It is not work!

I need to assgin the path to

.../ABC.app/Contents/MacOS/nwjs

and then it is work.

BUT the filename of plist will be nwjs.plist.

It is very easy duplicate with other NW.js program.

Package NW.js by nw-builder

@hedwigz
Copy link

hedwigz commented Aug 31, 2018

@weiluenju
I also faced this problem.
I think they should really add this to the documentation.
Mac hidden handling is different from Linux and Windows.
What you need to do is check the LoginItemSettings:

const loginSettings = app.getLoginItemSettings();
const hidden = loginSettings.wasOpenedAsHidden;

@adam-lynch
Copy link
Contributor

Please see that we're looking for contributors / maintainers: #64.

I'm happy to give access to people who are willing to help improve things, merge pull-requests, close issues, etc.

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

No branches or pull requests

3 participants