electron-archive / grunt-electron-installer

Grunt plugin to build Windows installers for Electron apps
MIT License
398 stars 106 forks source link

Can't create Desktop and Start Menu Icon #87

Closed andre-gois closed 8 years ago

andre-gois commented 8 years ago

Can someone point in the right direction?

I've built the installer and I'm able to run the app, I just can't figure out how to create the shortcuts. It seems the code will go in the squirrelCommand switch in my main .js file, can anyone show me an example?

Thanks!

enicolasgomez commented 8 years ago

Same here, not sure how to do that.

kevinmartin commented 8 years ago

Create: $ Update.exe --createShortcut MyApp.exe

Remove: $ Update.exe --removeShortcut MyApp.exe

You can see how Atom does it in CoffeeScript

lockys commented 8 years ago

I use below code to create shortcut. It works, but it creates the desktop shortcuts called Electron. Does anyone know how to customized the name of the shortcut?

function exeSquirrelCommand(args, cb) {
    var updateDotExe = path.resolve(path.dirname(process.execPath), '..', 'update.exe');
    var child = childProcess.spawn(updateDotExe, args, { detached: true });
    child.on('close', function() {
       cb();
    });
};

function install(cb) {
    var target = path.basename(process.execPath);
    exeSquirrelCommand(["--createShortcut", target], cb);
};

....

case '--squirrel-install':
  install(app.quit);

I have tried to change the target to <my-app>.exe, but it seems not a right solution.

anaisbetts commented 8 years ago

The Desktop shortcut info will be based on the EXE's File Properties (i.e. right click on file => Properties), electron-packager lets you change this (or a bunch of other Electron tooling things)

lockys commented 8 years ago

@paulcbetts got it :) thank you very much!

shenlq commented 8 years ago

thanks @lockys

shenlq commented 8 years ago

@lockys can you show me an example to change shortcut name?

lockys commented 8 years ago

@shenlq, sorry, I missed this thread. Maybe you have already solved this problem. But this is the command to do it using electron-packager. In this way, you can customize your name of shortcut on the desktop. In your project folder:

$ electron-packager . <output-name> --platform=win32 --arch=ia32 --version=0.34.2 --overwrite --icon=Icon.ico --version-string.ProductName=<product-name>

You can change the exe's file properties using the optional parameter called --version-string.ProductName=<product-name> More detail: https://github.com/maxogden/electron-packager#packageropts-callback

havenchyk commented 8 years ago

Please, ask on SO or in slack if you still have this problem.