This repository has been archived by the owner. It is now read-only.
Automatically move Electron apps to the Applications directory
JavaScript
Clone or download
Latest commit fe7bc7b Nov 30, 2017
Permalink
Failed to load latest commit information.
src Cleaned up examples, added resolution value to indicate whether user … Dec 11, 2016
.eslintrc Refactor, linting Dec 11, 2016
.gitignore first commit Dec 11, 2016
README.md Update README.md Nov 29, 2017
package.json 0.0.5 Feb 14, 2017

README.md

This functionality is now baked into Electron and the project is archived. I suggest using the new native API.

npm version

Electron LetsMove

A module that offers to automatically move your Electron app to the Applications folder if opened from another location. Inspired by LetsMove for MacOS.

Electron LetsMove

Requirements

This module is designed to be used within Electron on macOS, it can be included in a cross platform Electron app and is a no-op on the Windows and Linux platforms.

Installation

npm install --save electron-lets-move

Usage

You should call the moveToApplications method as soon as possible after the app ready event in the main process. Ideally before the user has any chance to interact with the application.

moveToApplications returns a promise that will resolve when the application is in the correct location, the user asked not to move or an error occurred. You can also provide an optional node-style callback as the only parameter.

ES5

const {app} = require('electron');
const {moveToApplications} = require('electron-lets-move');

app.on('ready', function() {
  moveToApplications(function(err, moved) {
    if (err) {
      // log error, something went wrong whilst moving the app.
    }
    if (!moved) {
      // the user asked not to move the app, it's up to the parent application
      // to store this information and not hassle them again.
    }

    // do the rest of your application startup
  });
});

ES6

import {app} from 'electron';
import {moveToApplications} from 'electron-lets-move';

app.on('ready', async () => {
  try {
    const moved = await moveToApplications();
    if (!moved) {
      // the user asked not to move the app, it's up to the parent application
      // to store this information and not hassle them again.
    }
  } catch (err) {
    // log error, something went wrong whilst moving the app.
  }

  // do the rest of your application startup
});

License

Electron LetsMove is released under the MIT license. It is simple and easy to understand and places almost no restrictions on what you can do with it. More Information