-
Notifications
You must be signed in to change notification settings - Fork 113
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
Auto Launch opens terminal on OSX #28
Comments
@luhfilho |
some here |
@CHENGP618 @Dihgg
I used username module, to get OS username folder to save plist file, this way, the OSX system will open your app on startup. |
@CHENGP618 @luhfilho, Also worked for me, a kind of workaround. |
What version of Mac is this happening on? Works for me on 10.9.5 |
@nickaversano 10.11.5 version |
I have the same experience on OSX 10.11.4 and I am using electron with electron-builder. I noticed that in OSX it is creating a Login Item for the user that points to a script within the app package, instead of pointing to the app itself (see below), at least for me. If the login item would just point to the application itself, it would work as intended, with no terminal window. Looking at the code, if you use electron and do not specify After that |
@djpereira what is your process.execPath on OSX 10.11? On 10.9 it is: ./node_modules/electron-prebuilt/dist/Electron.app/Contents/MacOS/Electron The interesting thing to note is that |
Thanks for asking @nickaversano. The process.execPath for in OSX 10.11 for our app is /Applications/My Electron App.app/Contents/Frameworks/My Electron App Helper.app/Contents/MacOS/My Electron App Helper We do have white spaces in our app name, not sure if that's an issue. |
@djpereira this definitely isn't a spacing issue. Happens to me on an app without spaces. Like you mentioned, I think this is happening because |
For anyone running into this issue for Electron apps, manually setting path to the outermost application path works. Here's my temporary workaround (tested on 10.9 and 10.11): var appPath = app.getPath('exe').split('.app/Content')[0] + '.app';
appLauncher = new AutoLaunch({
name: app.getName(),
path: appPath,
}); |
Thanks for the workaround @nickaversano. This worked very well for me. |
For NW.js the solution provided by @nickaversano works (only tested with The following is code from my project. It fixes the path on OS X and removes the bad login item function getCurrentApplicationPath() {
if (global.process.platform === 'darwin') {
return global.process.execPath.split('.app/Content')[0] + '.app';
}
return null;
};
const bootLauncher = new AutoLaunch({
name: APP_NAME,
path: getCurrentApplicationPath(),
isHidden: false,
});
// remove any existing `nwjs Helper` login item on app start
bootLauncher.removeNwjsLoginItem(); |
Hey everyone, could you please confirm if #38 fixes this? |
Nope, I think there is still a bug. Will share details in #38. |
I was also having this problem (I've not yet tested #38), but here's the hack I used on Electron to get it to work for me:
(I'm using asar to pack my app, which is why there's 3 '..') |
OK I've just released 5.0.0. Please give that a try and let me know if the issue persists. If so, also try the new Launch Agent option. If it still persists, I'm going to need more information and probably an example app. I need the versions of what you're using, the options being passed to our module, if you're using it in the Electron main or renderer process, and what your If your problem has been solved, please let us know too. Thanks. |
The issue persists, still seeing the Terminal on Mac. Windows is fine. |
some here
|
@orther right
|
Are you using Electron? If so, in the main or a renderer process? |
Using OSX 10.12.1 and Electron 1.4.3. Triggering this in the main process. Using the "fix" @sujkh85 suggests (only on Mac) fixes it for me. |
@adam-lynch yes use Electron
ipcMain is electron object
|
Pull request that can solve that: #34 |
Meanwhile, I pushed a patched version of this module to npm: auto-update-patched
var AutoLaunch = require('auto-launch-patched'); So it can be used instead, while #34 is merged into auto-launch. |
I have found a difference between usage of If true, you have to specify path as app.getPath('exe') provides (without split last part) Does it work for all? |
I was having this issue in macOS, for an electron app built with But after changing the option to set the auto launcher using a "launch agent" as described in https://github.com/Teamwork/node-auto-launch#launch-agent it worked without a problem. Here's the relevant code I had: const autoLaunch = new AutoLaunch({
name: app.getName(),
}); And I changed it to: const autoLaunch = new AutoLaunch({
mac: {
useLaunchAgent: true,
},
name: app.getName(),
}); That solved the issue, at least in my case. |
For nwjs .apps, the solution is definitely along the lines of @orther's solution. That works. |
Apologies, we've neglected this project a little bit. We're going to fix that though, see #64. I'm going to put in some time this Saturday. If someone could provide a simple app by then that reproduces this (or if it's simply the Electron hello world app), then that would help things along. |
I've just published @luhfilho @djpereira @nickaversano @guerrerocarlos since you all looked into the code a bit... I don't know if you saw #64 but we're looking to bring add some contributors/maintainers to help with:
Would you be open to that? I can give you access. |
Hi,
I have implemented auto launch and it works perfectly at windows and linux, but, at osx the terminal opens and if I close it, the app is terminated.
Follow the code below.
Are there any missing configurations?
The text was updated successfully, but these errors were encountered: