Git Product home page Git Product logo

node-auto-launch's Introduction

node-auto-launch

NPM version Build Status Windows Build Status Dependency Status


Auto-launch your app on login.

  • ⭐ Launch any application or executable at startup / login / boot.
  • ⭐ Supports Linux, FreeBSD, Mac (via AppleScript or Launch Agent), and Windows.
  • ⭐ Supports NW.js and Electron (with or without Squirrel; i.e. even if you're using Electron's built-in autoUpdater API).
  • ⭐ Auto-detects your app path for NW.js and Electron apps.
  • ⭐ Supports NW.js and Electron apps in Windows Store (with some caveats).
  • 😞 Not Mac App Store friendly. See Make this Mac App Store compatible for more information.

Usage

var AutoLaunch = require('auto-launch');

var minecraftAutoLauncher = new AutoLaunch({
	name: 'Minecraft',
	path: '/Applications/Minecraft.app',
});

minecraftAutoLauncher.enable();

//minecraftAutoLauncher.disable();


minecraftAutoLauncher.isEnabled()
.then(function(isEnabled){
	if(isEnabled){
	    return;
	}
	minecraftAutoLauncher.enable();
})
.catch(function(err){
    // handle error
});

Installation

npm install --save auto-launch

API

new AutoLaunch(options)

options - Object

options.name - String

The name of your app.

options.path - String (optional for NW.js and Electron apps)

The absolute path to your app.

For NW.js and Electron apps, you don't have to specify the path. We guess based on process.execPath.

options.isHidden - (Optional) Boolean

If true, we instruct the operating system to launch your app in hidden mode when launching at login. Defaults to false.

options.mac (Optional) object

For Mac-only options.

options.mac.useLaunchAgent (optional) Boolean.

By default, we use AppleScript to add a Login Item. If this is true, we use a Launch Agent to auto-launch your app. Defaults to false. For more information, see How does it work? (mac) below.

.enable

Sets your app to auto-launch at startup. Returns a Promise.

.disable

Disables your app from auto-launching at startup. Returns a Promise.

.isEnabled()

Returns a Promise which resolves to a Boolean; true if your app is set to launch on startup.

How does it work?

Linux / FreeBSD

A Desktop Entry is created; i.e. a .desktop file is created in ~/.config/autostart/.

Note: if auto-launch is enabled and then your app is removed, this desktop entry file would be left behind on the user's machine.

Mac

AppleScript (default)

We execute an AppleScript command to instruct System Events to add or remove a Login Item for your app. There are no files involved. To see your Login Items, you can go to System Preferences, Users & Groups, then Login Items. End users can add or disable items (including your app) here also, but most typical users aren't aware of it.

Login Items screenshot

Note: This is not Mac App Store friendly; if you use it in your app, it will be rejected by the Mac App Store. We're only 99% sure on this as we haven't actually tried ourselves. See Make this Mac App Store compatible for more information.

Launch Agent

This is a file-based method like Linux's Desktop Entry method. We add a .plist file in the user's Library/LaunchAgents directory to create a Launch Agent for your app.

Pros

  • Launch Agents are intended for daemons / something without UI, which might be applicable depending on your app.
  • We think this method seems to be faster, as in to enable or disable auto-launching (there is no difference in the amount of time it takes your app to launch). Although, that's not really a concern.
  • You might not trust AppleScript.

Cons

  • Your app will not appear in the user's Login Items. Therefore the user can only toggle auto-launching inside your app, if you provide them with a setting of course (which you should!). This is not a huge deal as most users are not aware of Login Items preferences, but it would be ideal if your app appeared there.
  • If the user was to remove your app, the file would be left behind on the user's machine.

If you find that the AppleScript method doesn't work for you and this method does, please let us know by creating an issue.

Note: This is not Mac App Store friendly; if you use it in your app, it will be rejected by the Mac App Store as this reaches outside of the app sandbox. See Make this Mac App Store compatible for more information.

Windows

We add a registry entry under \HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run.

Note: If the user was to remove your app, this would be left in the registry, but that's not such a big deal. You can probably configure your uninstaller to unset it.

Squirrel.Windows

If you're using Squirrel.Windows, i.e. what's underneath Electron's built-in autoUpdater API on Windows, we add a registry entry for your app's Update.exe instead of your actual application. This is due to how Squirrel.Windows works under the hood. What if we didn't? Well, if the user started / restarted their machine after updating your app, it would launch the old version by mistake.

Windows App Store apps

If you have your Electron-based app in the Windows Store and would like to include auto launch functionality, simply linking to the executable path will not work. The Appx packages required for Electron are sandboxed and the install location can only be accessed by the system itself.

There is a way to bypass that - it will require you to know the developer ID, app ID and package name of your app. Then, instead of using the exec path, you will need to set the path in AutoLaunch() config to: explorer.exe shell:AppsFolder\DEV_ID.APP_ID!PACKAGE_NAME. One of the way you can find your apps details is by following this article. Note that you might need to compile and submit your app to the store first to obtain these details.

If you've already submitted your app, you may use the follow steps to find the path:

  • Install a beta version on your Windows device from Microsoft Store
  • Go to Windows apps folder: press Win+R and type shell:AppsFolder
  • Right-click and create shortcut on Desktop
  • Right click on the shortcut and check properties
  • Find target field and copy the content. That will be the auto-launch path

Example: new autoLaunch({ name: 'APP_NAME', path:"DEV_ID.APP_ID!PACKAGE_NAME", isHidden: true })

Would you like to contribute?

We're always open to your help and feedback. See our CONTRIBUTING.md.

node-auto-launch's People

Contributors

4ver avatar adam-lynch avatar alanning avatar artemv avatar edjafarov avatar edulan avatar emmetcampion avatar greenkeeperio-bot avatar henryhu avatar marshallofsound avatar miloszfalinski avatar noamokman avatar nono avatar oxalin avatar razzeee avatar robwilkerson avatar willbarrett avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-auto-launch's Issues

Uncaught Exception: Cannot find module 'applescript'

  • The target platform: macOS 10.11
  • Node version: 5.6.0
  • auto-launch version: 5.0.0
  • The options you're passing to auto-launch: name (packageJson.name)
  • Are you using NW.js or Electron? Electron 1.4.0 (main process)
  • Can you reproduce this with a simple Hello World example app? Yes
  • If needs be, would you be able to provide us with a simple app (as simple as possible) which reproduces the problem? electron-sample-app

  • After building the app with electron-packager, launching the generated .app results in the error:
    screenshot
  • Manually adding the applescript dependency to the project mitigates the problem.

Autolaunch in linux (ubuntu) launches electron executable - not the electron app.

  • The target platform(s) the problem occurs on (Linux, Mac, Mac App Store, and or Windows): Ubuntu
  • Node version (run node -v): v7.0.0
  • auto-launch version: 5.0.1
  • The options you're passing to auto-launch:

var axareminderLauncher = new AutoLaunch({
name: 'AxaReminder',
isHidden: true,
});

  • Are you using NW.js or Electron? Electron
    • If so, which version? 1.4.0
    • If you're using Electron, are you using auto-launch from the main process or a renderer process? Main process

The autostart file created is for electron executable and not the electron app.
This is the options given.
var axareminderLauncher = new AutoLaunch({
name: 'AxaReminder',
isHidden: true,
});

Even though the name is given, this is the file created.
Type=Application
Version=1.0
Name=electron
Comment=electronstartup script
Exec=/usr/lib/node_modules/electron/dist/electron --hidden
StartupNotify=false

Issues:

  1. Name is wrong
  2. exec is for electron app not the actual application.

Asar not packing auto launch

I am currently using electron-packager to get convert my electron app to executable. It uses asar to pack all the node modules but auto-launch module is not packed by asar. When I unpack the asar and then put auto-launch into the node-modules and then packing it works fine. Does anyone else have the same problem ?

Mac auto launch through LaunchAgent does not work

  • Platform: Mac
  • Node version: 8.5.0
  • auto-launch version: 5.0.3
  • Electron: 1.6.8 main process

According to #34 , if the given path is the path of inner binary, it will be replace to app directory itself.
It may should graceful information in Login Item Preferences.
However, it breaks with LaunchAgent, because LaunchAgent needs inner binary path.

Support isHidden flag on Windows

With the registry approach, I'm not sure of a way to support isHidden. But could you append it to the launch path as a command-line argument? Something like this:

if isHidden
  regKey.set opts.appName, Winreg.REG_SZ, "#{opts.appPath} -hidden", cb
else
  # Same as before

That way, individual apps could parse the argument on their end to support it.

Issue creating auto-launch for Mac + nwjs

  • The target platform(s) the problem occurs on (Linux, Mac, Mac App Store, and or Windows): Mac 10.12.4
  • Node version (run node -v): v6.10.0
  • auto-launch version: 5.0.1
  • The options you're passing to auto-launch: just name
  • Are you using NW.js or Electron? Yes
    • If so, which version? NWjs 58.0.3029.110
    • 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?

Once I create auto-launch for my application it fails with the next error:

[0608/100331.289731:FATAL:chrome_main_delegate.cc(783)] Check failed: command_line.HasSwitch(switches::kProcessType) && !process_type.empty(). Helper application requires --type.
0 nwjs Framework 0x000000010c382eb3 _ZN2v88UnlockerD1Ev + 15202595
1 nwjs Framework 0x000000010c39c037 _ZN2v88UnlockerD1Ev + 15305383
2 nwjs Framework 0x000000010aaa7683 ChromeMain + 3539
3 nwjs Framework 0x000000010aaa7794 ChromeMain + 3812
4 nwjs Framework 0x000000010bfb8d62 _ZN2v88UnlockerD1Ev + 11229138
5 nwjs Framework 0x000000010bfb83be _ZN2v88UnlockerD1Ev + 11226670
6 nwjs Framework 0x000000010aaa68fb ChromeMain + 75
7 nwjs Helper 0x000000010aa6ddca main + 522
8 libdyld.dylib 0x00007fffb2cdf235 start + 1

And the process exists.

The command that is being invoked with AppleScript or with Launch agent is:
"Alertsite Desktop Proxy.app/Contents/Versions/57.0.2987.98/nwjs Helper.app/Contents/MacOS/nwjs Helper"

If however the command were:

"Alertsite Desktop Proxy.app/Contents/MacOS/nwjs"

It would work like a charm. Am I doing something wrong ?

Thanks a lot in advance.

Auto Launch opens terminal on OSX

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.

var AutoLaunch = require('auto-launch');

var appLauncher = new AutoLaunch({
    'name': appName
});

appLauncher.isEnabled().then((enabled) => {
    if (enabled) return;
    return appLauncher.enable()
}).then((err) => {});

Are there any missing configurations?

Remove CoffeeScript

We're going to use plain JavaScript in this repository from now on. Why?

  • It makes it easier for people to contribute.
  • No build step needed.
  • Forks are easier to test because the JavaScript is in the repository.

So the existing CoffeeScript needs to be converted to JavaScript. Nothing too fancy, we don't want to have to introduce babel or require users to have Node 8 as a minimum or anything like that.

In doing this, gulp could be removed too but the tests need to still be runnable via npm test.

Electron Application Not Opening On Startup - MacOS

Hello There,

I am trying to open a simple electron application on startup. Below is my code, i think i am doing something wrong, can you please help. Please pardon me if i have missed something. Thanks.

'use strict';

var AutoLaunch = require('auto-launch');

var appLauncher = new AutoLaunch({
name: 'My NW.js or Electron app'
});

appLauncher.isEnabled(function(enabled){
if(enabled) return;

appLauncher.enable(function(err){

});

});

// Module to control application life.
const app = electron.app;
// Module to create native browser window.
const BrowserWindow = electron.BrowserWindow;

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow;

function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({width: 1620, height: 740});

// and load the index.html of the app.
mainWindow.loadURL('http://orcatv.net/pace/nyc720.php');

// Open the DevTools.
mainWindow.webContents.openDevTools();

// Emitted when the window is closed.
mainWindow.on('closed', function() {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null;
});
}

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
app.on('ready', createWindow);

// Quit when all windows are closed.
app.on('window-all-closed', function () {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit();
}
});

app.on('activate', function () {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow();
}
});

Contributors wanted

Problem

We've neglected this project a little bit. Apologies.

Cause

Background: I moved into another project within Teamwork which hasn't any desktop apps and the Teamwork Chat team (@4ver, etc.) have had a lot on their plate.

Solution

We're going to fix this. We're going to allocate dev time each month or something like that to keep a better eye on the project.

We need your help

It's also really important that we get some outside contributors as well though. So if anyone can help out in these areas, it would be much appreciated:

  • Improving documentation.
  • Troubleshoot, triage, and reproduce issues on your machine.
  • Fix bugs.
  • General maintenance (dependencies, etc).
  • Suggest & add features.
  • Review, test, and merge pull-requests from other contributors.
  • Anything else you can think of which would help.

Feel free to go ahead and do any of those or write to us (in an issue, email, etc.) if you like.

Ideas / Improvements

These are some possible improvements that come to mind right now:

  • Convert codebase from CoffeeScript to plain JavaScript to make it easier for people to contribute.
  • Add example (e.g. Electron, NW.js) projects to make it clearer how to use this module. This is also useful for manually testing the module during development.
  • List the maintainers in the README.
  • Label issues as good first issue and help wanted.
  • Etc.

Option to set 'KeepAlive' on mac

  • The target platform(s) the problem occurs on (Linux, Mac, Mac App Store, and or Windows): Mac
  • Node version (run node -v): 6.10.0
  • auto-launch version: 5.0.1
  • The options you're passing to auto-launch:
  • Are you using NW.js or Electron - Electron main process
    • If so, which version?
    • 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? Yes

I notice that the plist is created with the <key>RunAtLoad</key> whose value is true.
Is there any option to set <key>KeepAlive</key> to true also?

something like this -

          mac: {
            useLaunchAgent:true,
            keepAlive: true
          }

Windows registry key pointing to an older version of an electron-based app after an upgrade using Squirrel

The install location of the .exe for Windows changes as you update your app when you use Squirrel.Windows (see https://github.com/Squirrel/Squirrel.Windows/blob/master/docs/using/install-process.md#install-location).

When you call the enable command, auto-launch creates a registry key using the path to the current version, but this does not get updated as you deploy newer versions of your app thru Squirrel and electron's auto-update.

A possible workaround is to listen to the --squirrel-updated event and call the enable command again, so the registry key gets recreated.

I am wondering if I am missing something or if there is a better workaround.

Add option to pass additional arguments to the startup command.

It would be great if there was an additional option to add -- prefixed arguments to the start-up file (at least the Linux .desktop file). As an example, I use Wire Desktopm, which can be launched minimized by passing the --startup flag to the wire command, however there is no option to add --startup to the desktop file generated by auto-launch. Thanks!

Setting start path to Update.exe does not work

  • The target platform(s) the problem occurs on (Linux, Mac, Mac App Store, and or Windows): Windows 8.1

  • Node version (run node -v): 6.3.0

  • auto-launch version: 5.0.1

  • The options you're passing to auto-launch: var AutoLaunch = require("auto-launch");

    var appLauncher = new AutoLaunch({
    name: "Trampoline"
    });

  • Are you using NW.js or Electron? Electron

    • If so, which version? "1.6.6"
    • If you're using Electron, are you using auto-launch from the main process or a renderer process? main process
  • Can you reproduce this with a simple Hello World example app? haven't tried yet

  • If needs be, would you be able to provide us with a simple app (as simple as possible) which reproduces the problem? will prepare one


The issue is, that calling appLauncher.enable() creates registry entry pointing to executable path. It documentation there is info, that squirrel should be detected and path to Update.exe should be set. Is it true? What should I set, that auto-launch detect squirrel?

Additionaly, if I set name and path (calculated path do the Update.exe --processStart trampoline.exe) i get such entry in registry: Update.exe --processStart trampoline, but the name is set to Trampoline... It seems to be ignored and taken from appPath with removing ending .exe...

EDIT: it cannot work, as paths are set in fixOpts function, that sets for windows invalid path and entry name.

Extend API for isHidden to make that option more easily user settable

I would like to be able to make whether the application is hidden on auto launch user settable, but the current API doesn't make that feasible. There is no way to easily tell if the currently enabled auto-launch is configured to launch hidden, or to change the setting for an AutoLaunch instance.

Execute path was not escaped on Linux

  • The target platform(s) the problem occurs on: Linux
  • Node version (run node -v): 8.10.0
  • auto-launch version: 5.0.5
  • The options i'm passing to auto-launch:
var autoLauncher = new AutoLaunch({
    name: 'Name with space',
});
  • Electron 1.8.4
  • Main process

If I pass value for option name in AutoLaunch object which has whitespace, the execute path in .desktop file will not be escaped.
Value: Name with space
Expected execute path: /opt/Name\ with\ space/app
Actual execute path: /opt/Name with space/app (missing \ to escape whitespace)

After auto launch, the electron default app is getting started first. Then my app is starting

Welcome to Electron

To run your app with Electron, execute the following command under your Console (or Terminal):

path_to_generated path-to-your-app
The path-to-your-app should be the path to your own Electron app, you can read the quick start guide in Electron's docs on how to write one.

Or you can just drag your app here to run it:

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

Windows Auto-launch app doest work

  • The target platform(s) the problem occurs on (Linux, Mac, Mac App Store, and or Windows):
    windows
  • Node version (run node -v):
    7.0.1
  • auto-launch version:
    5.0.3

Hi I was trying to auto-launch an app as with this simple script as follows

image

but I got a problem the app didnt start,

when I use the name micrefat.exe in the path option like this :

image

any proccess is created whit the name 'minecraft' at the task administrations' tab startup,

but when I used it in this way

image

it does create a minecrafst.exe at the task-admininstration' tab startup (you can see that at the first screenshoot), the problem is when i restart the computer, nothing happen, Im my doubt is , this little detail about the name of the path file could afecting the startup of the app?

ty guys cheese

Shows terminal window when auto-launch

Hi there I met a issue that my Application shows Unix executable instead of Application in Users & Groups.

Therefore, when I login my Mac, a terminal window would open and shows

Last login: Mon Jul 24 10:20:14 on ttys000
~ /Applications/appName.app/Contents/MacOS/appName ; exit;
/Library/Caches/com.apple.xbs/Sources/AppleGVA/AppleGVA-10.1.16/Sources/Slices/Driver/AVD_loader.cpp: failed to get a service for display 3 
/Library/Caches/com.apple.xbs/Sources/AppleGVA/AppleGVA-10.1.16/Sources/Slices/Driver/AVD_loader.cpp: failed to get a service for display 4 
/Library/Caches/com.apple.xbs/Sources/AppleGVA/AppleGVA-10.1.16/Sources/Slices/Driver/AVD_loader.cpp: failed to get a service for display 5 
/Library/Caches/com.apple.xbs/Sources/AppleGVA/AppleGVA-10.1.16/Sources/Slices/Driver/AVD_loader.cpp: failed to get a service for display 6 

Once I stop the process, the application would quit.

and there is how I package the application:

"build": "concurrently \"npm run build-main\" \"npm run build-renderer\"",
build-main": "cross-env NODE_ENV=production node --trace-warnings -r babel-register ./node_modules/webpack/bin/webpack --config webpack.config.main.prod.js --colors",
    "build-renderer": "cross-env NODE_ENV=production node --trace-warnings -r babel-register ./node_modules/webpack/bin/webpack --config webpack.config.renderer.prod.js --colors",
"package": "npm run build && build --publish never",

Is there anything wrong with my code? Or is it how it supposed to be that way?

Add `toggle` method for easy enable/disable

Add toggle method for easy enable/disable. This makes it easy to set based based on a variable.

Current:

var somebool;
autoLauncher[(somebool ? 'enable' : 'disable')](function(err) {
   console.log(err);
});
// or
(somebool ? autoLauncher.enable : autoLauncher.disable).bind(autoLauncher)(function(err){
   console.log(err);
});

Desired:

var somebool;
autoLauncher.toggle(somebool, function(err) {
   console.log(err);
});

Cannot find module 'auto-launch'

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

Here is a minimal example that produces the error:

var AutoLaunch = require('auto-launch');

After installing [email protected], I am unable to require the module. Each time I run, I get the following error:

module.js:471
    throw err;
    ^

Error: Cannot find module 'auto-launch'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/benj/Projects/test/index.js:1:80)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

Upon further investigation, I can see that node_modules/auto-launch has no dist folder, nor does it have any JavaScript files of any kind. It looks as if the files were missing from the published package. This does not occur on version 5.0.1.

Electron app not hidden on startup

I've tried setting isHidden to both true and false but neither works.

I'm guessing that calling the show() method on the main electron window is what's causing this behavior. How do I check that the app has launched at startup to avoid showing the main window?

not work with lastest electron

  1. I found there is still es6-promise reference even you mentioned in lastest version it will be remove

Promise = require('es6-promise').Promise;

in dist/index.js

  1. then I installed es6-promise and it does not have any error now, but it does not make my app lanuch on windows startup by doing
    appLauncher.enable()

My electron is v1.3.3

  1. what I want is auto launch as minimised on tray, hope this feature can be provied.

Thanks.

executable doesn't start because of spaces in path

  • The target platform(s) the problem occurs on Linux
  • Node version (run node -v): 6.11.5
  • auto-launch version: 5.0.3
  • The options you're passing to auto-launch: {"name": "my-desktop"}
  • Are you using NW.js or Electron? Electron
    • If so, which version? 1.7.9
    • If you're using Electron, are you using auto-launch from the main process or a renderer process? main

The generated .desktop file in ~/.config/autostart looks like the following

[Desktop Entry]
Type=Application
Version=1.0
Name=my-desktop
Comment=my-desktopstartup script
Exec=/opt/My Desktop/my-desktop
StartupNotify=false
Terminal=false

It would work with the space being escaped (Exec=/opt/My\ Desktop/my-desktop), or the complete path put within quotes (Exec="/opt/My Desktop/my-desktop"). At least that is what I've tested on my system (Ubuntu 16.04) and worked. It did work on OSX and Windows though.

Hidden doesn't seem to work on Windows 7

  • The target platform(s) the problem occurs on (Linux, Mac, Mac App Store, and or Windows): Wundows
  • Node version (run node -v): 6.5.0
  • auto-launch version: 5.0.1
  • The options you're passing to auto-launch:
    name: 'myApp',
    isHidden: true,
  • Are you using NW.js or Electron? Electron
    • If so, which version? 1.4.6
    • If you're using Electron, are you using auto-launch from the main process or a renderer process?
      Running from the renderer process
  • Can you reproduce this with a simple Hello World example app?
    Have not yet tried
  • If needs be, would you be able to provide us with a simple app (as simple as possible) which reproduces the problem?
    Not at this time, but possibly if this issue is deemed as potentially real and not an implementation mistake.

The app does not launch hidden on Windows 7. I am running with electron-react-boilerplate, which builds with electron-builder 8.5.3

How does this package interact with window.show() in Electron?

Modify startup status on Windows

Currently auto-launch will add/delete a registry key to add it to the startup list. WIndows also seems to remember what the status that was set between adding/removing from the startup list which probably means that it is a separate registry key entry somewhere else.

Can we change the startup status to Enabled/Disabled if the key already exists?


API-wise, the default for the enable/disable methods would probably be setting the status if it already exists, and then pass a "hard" option in to delete it from the startup list.

// Set the status to `Enabled` if it already exists
// Otherwise create the entry
autoLaunch.enable();
// Set the status to `Disabled`
autoLaunch.disable();
// Remove from startup list
autoLaunch.disable(true);

Registry is not created in Windows and App doesn't start with Windows

  • The target platform(s) the problem occurs on (Linux, Mac, Mac App Store, and or Windows):
    Windows
  • Node version (run node -v):
    7.10.0
  • auto-launch version:
    5.0.1
  • The options you're passing to auto-launch:
  • Are you using NW.js or Electron?
    Electron
    • If so, which version?
      1.7.6
    • If you're using Electron, are you using auto-launch from the main process or a renderer process?
      renderer process

My application doesn't start when Windows is restarted and a
registry entry under \HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run is not created.

How to make it compatible with sandboxed Electron app for Mac App Store?

Anyone has any experience as to how to make auto-launch work on a Mac App Store Electron build?

All system-level functionality is locked by default, so it will probably need to be enabled in the entitlements files used to sign the build. I've tried adding temporary exceptions like below, but it doesn't seem to work.

<key>com.apple.security.temporary-exception.apple-events</key>
<array>
    <string>com.apple.systemevents</string>
</array>

Unable to make the application run on startup for all users

Platform: Windows 10 x64
Node v6.11.2
auto-launch v5.0.1

Using electron, and after installation i run a form which user has to enter configuration for the application, there the auto-launch should work, the problem is that the installation wizard (thus the configuration form) runs under a specific user, and the main application (which i need to set the auto launch for) runs under different user.

And because of this the auto launch functionality wont work because the registry change is under HKCU, to resolve this there must be a parameter in the construct whether the auto launch should be for all users or not, and this boolean value will decide whether to make the change in HKCU or HKLM.

Cannot disable.

Using windows 10, nw.js 0.12.3 running as administrator.

Looked at the source:

disable: function(opts, cb) {
    return regKey.remove(opts.appName, cb);
  }

So its supposed to remove the key in regedit but it does not.

68:87: execution error: System Events got an error: AppleEvent timed out. (-1712)

This issue is coming when i restart my system and app throw error.

Mac 10.11.6
node 5.8.0
auto-launch 5.0.0

Error: Command failed: osascript -e ' tell application "System Events" to set isUIScriptingEnabled to UI elements enabled
if isUIScriptingEnabled = false then
return false
end if
return true'
68:87: execution error: System Events got an error: AppleEvent timed out. (-1712)


Module not found on windows build

Hey, thanks for developing this module!

It works fine, except one thing:

I build my node-webkit application for windows and os x (currently developing on os x) with nw-builder. Running the builded package on os x works fine, except on windows the module 'auto-launch' can't be found.

The module is installed via npm. Is there anything I need to configure specifically for windows?

isHidden argument does not hide the app

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.

TypeError: Path must be a string. Received undefined

  • The target platform(s) the problem occurs on (Linux, Mac, Mac App Store, and or Windows):
    Windows 8.1
  • Node version (run node -v):
    7.7.4
  • auto-launch version:
    5.0.3
  • The options you're passing to auto-launch:
  • Are you using NW.js or Electron?
    Electron
    • If so, which version?
      1.7.9
    • If you're using Electron, are you using auto-launch from the main process or a renderer process?
      main
  • 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?

const launcher = new AutoLaunch({
        name: result.productName,
        path: 'C:\\Program Files\\test\\service\\6.0.177\\test.exe', 
        isHidden: true
    });
    try {
        await launcher.enable();
        log.info(MODULE_NAME, `auto-launch ${result.productName} successfully!`);
    } catch (error) {
        log.error(MODULE_NAME, `auto-launch ${result.productName} failed! ${error}`);
    }```

I also tried to remove `path` but it's the same result 

How to handle the hidden in MacOS?

  • 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.

opts.appName strips last 4 characters

I'm working on an Electron app where, in development, the appName is simply Electron rather than Electron.app. On OS X, this is a problem because the fixOpts() method "adjusts" the appName for display by lopping off .app even if it doesn't exist in the name.

It would be nice if the method would at least ensure that the appName ends with .app before stripping those last four.

release v5.0.2 unusable

  • The target platform(s) the problem occurs on: Mac
  • Node version: v8.8.1
  • auto-launch version: 5.0.2
  • The options you're passing to auto-launch: Electron v1.4.6 / main process

verify steps:

  1. install auto-launch v5.0.2
npm install [email protected]
  1. see auto-launch installed package directory
open ./node_modules/auto-launch

only 3 files in the package directory: LICENSE.md、package.json、README.md。dist folder lost.

Issue on isEnabled change value

  • Platform: macOS, Windows, Linux
  • Node 8.9.0
  • auto-launch version: ^5.0.5
  • Options I'm passing to auto-launch: name
  • Using Electron 1.7.9
  • Using auto-launch from main process

I enabled auto-launch, then I delete login item in my OS, how my app can detect if login item was deleted from system.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.