node-auto-launch icon indicating copy to clipboard operation
node-auto-launch copied to clipboard

isHidden argument does not hide the app

Open akashnimare opened this issue 8 years ago • 7 comments
trafficstars

node-auto-launch - latest
OS - macOS/Linux

I'm using this in an electron app here. It successfully launches the app on system startup but the isHidden option is not working and it doesn't hide the app even on setting it to true. Here is the relevant code - https://github.com/zulip/zulip-electron/blob/hidden-on-startup/app/main/startup.js https://github.com/zulip/zulip-electron/blob/80c37fabb8bf05521c4df47552f82bcd3d41db5d/app/renderer/js/components/webview.js#L73

@adam-lynch let me know if I'm doing anything wrong here.

akashnimare avatar Nov 09 '17 18:11 akashnimare

Hmm I'm not sure. It works in a simple app for me here. I've just published 5.0.2 which fixes the path problem. Just in case, could you try it with 5.0.2 and no path argument?

adam-lynch avatar Nov 11 '17 17:11 adam-lynch

I doubt it will fix the problem since it successfully launches the app on startup only the hidden mode doesn't work. Let me test it on 5.0.2.

akashnimare avatar Nov 11 '17 18:11 akashnimare

Please have you been able to get it to work now, I'm also facing similar issue using a windows 10 device.

king-d-dev avatar May 12 '19 20:05 king-d-dev

I am using 5.0.5 and just tested if the hidden option is working for me on windows 10. In fact it doesnt.

The registry key looks like that:

"C:\path\to\my\app.exe" --hidden

yafp avatar Jul 04 '19 10:07 yafp

Hi! I am facing the same issue for an electron app. Did any of you guys found a solution or workaround?

I am using:

Windows 10 Build 19043, Node 14.16.1 Electron 13.1.4 auto-launch 5.0.5

My code is straightforward and taken from the documentation:

// Calling autolaunch from main process
const autoLaunch = new AutoLaunch({
  name: 'My App',
  path: app.getPath('exe'),
  isHidden: true,
})

autoLaunch.isEnabled().then((isEnabled) => {
  if (!isEnabled) autoLaunch.enable()
})

The registry in \HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run gets created OK including the --hidden flag.

I don't know where the flags are defined so I used Process Explorer as detailed here to see if I could find any flag that could work. I found the openAsHidden flag, but it didn't do anything (I don't know if is a valid flag tbh). If someone knows where flags are defined I'll be thankful.

I also tried with cmd.exe /c start /min "path to app" (info). But it did not work either.

Finally, I tried with some arbitrary flags: -silent, /background. Neither of those did anything.

I'm out of ideas :cry:, any help is welcome.

Thanks, Rodrigo.

rbestardpino avatar Jul 05 '21 16:07 rbestardpino

For documentation purpose: the argument "isHidden" doesn't magically hide the application except with AppleScript. For all other cases, it adds the argument when the application is called at launch, but the application still needs to deal with it in a way or another.

Using Electron, this could be done my calling some available methods for Windows and macOS though. But if IRC, this is not available under Linux. And for any other situation without Electron, the dev would still needs to do something of the argument to hide the application on startup.

Oxalin avatar Mar 19 '24 04:03 Oxalin

Clarify how it works in README.md

Oxalin avatar Mar 19 '24 04:03 Oxalin