Electron-builder: Specify own Info.plist file and create desktop shortcut icon?

Created on 29 Jun 2016  Â·  15Comments  Â·  Source: electron-userland/electron-builder

  • Version: 5.10.1

  • Target: macOS, Windows

Qeustion 1:

I would like to build my app for macOS through, but my app implemented a protocol for web url lunch my app, for example: using builder://. In which case, I need to specify the Info.plist file for the CFBundleURLTypes.

The electron-packager support an option for specify my own plist file.

I read the electron-builder document and also tried to specify .build.mac.entitlements path to my own .plist file, it seems like doesn't work.

Is there any way to specify it on the package.json?

Qeustion 2:

The windows installer installed the app files into C:\Users\ouchangkun\AppData\Local\appname\app-version, is there any way to make installer create an desktop shortcut icon and Start lunch menu?

Thanks a lot. :)

question

Most helpful comment

The windows installer installed the app files into

If you use default Squirrel.Windows, please read https://github.com/electron/windows-installer#handling-squirrel-events (in short — use https://github.com/mongodb-js/electron-squirrel-startup)

NSIS installer creates shortcuts without any code on your side (but currently NSIS doesn't support auto-update).

All 15 comments

The windows installer installed the app files into

If you use default Squirrel.Windows, please read https://github.com/electron/windows-installer#handling-squirrel-events (in short — use https://github.com/mongodb-js/electron-squirrel-startup)

NSIS installer creates shortcuts without any code on your side (but currently NSIS doesn't support auto-update).

Use build.extend-info (https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#extend-info) to add custom entries to the Info.plist.

@develar thx a lot~

Trying to register custom protocol:

The current Electron-API-demo uses electron-packager.
From https://github.com/electron-userland/electron-builder/wiki/Options, seems to provide this functionality! I created myApp/Contents/Info.plist. Is there any way to pass this to build options using only electron-builder (without electron-packager)?

main.js:

...
// works
app.on('open-url', function (event, url) {
  event.preventDefault();
  logEverywhere(url)
})
...

This code works as expected, when i call it from etc Safari addressbar myapp://param, i can see the whole scheme at console log. This is only valid when already exists an app instance.

When app is closed, calling it with myapp://param, just opens the app, but doesn't log the whole url scheme!
Code used:

...
// issue: log protocol scheme at first app instance
app.on('will-finish-launching', () => {
  // prints just the executable without protocol scheme
  logEverywhere(process.argv)
})
...

What i am missing?

Also what is the proper way to edit Info.plist?

  1. Edit directly the electronApp/node_modules/electron/dist/Electron.app/Contents/Info.plist
  2. Create file at electronApp/Contents/Info.plist

I 've made a question with sample code and link to GitHub minimal project && SO if helps, to see where i am:
https://discuss.atom.io/t/open-app-and-pass-parameters-with-deep-linking-using-electron-osx/42630

@oikonomopo To customize Info.plist, please use https://github.com/electron-userland/electron-builder/wiki/Options#MacOptions-extendInfo

Thanks!

Use build.extend-info (https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#extend-info) to add custom entries to the Info.plist.

I don't see a detailed explanation about build.extend-info in electron builder-builder documentation. It's straight forward if I want to add .plist entries in the form of object. The below code is working fine with the electron-builder.

"mac": {
"extendInfo": {
"LSUIElement": 1
}
}

But in case of file name, where should I put my custom .plist file and how to pass the file name into extendInfo?

@sanoop-jose

the file name into extendInfo?

what filename do you mean?

what filename do you mean?

I mean if I pass my custom plist file name instead of an object, electron-builder failed to add those properties in to the info.plist(This feature is available in the electron-packager).

"mac": {
"extendInfo": "myPlist.plist"
}

Is there any other way to read properties from an external file and merge to info.plist?

main.js:

...
// works
app.on('open-url', function (event, url) {
  event.preventDefault();
  logEverywhere(url)
})
...

This code works as expected, when i call it from etc Safari addressbar myapp://param, i can see the whole scheme at console log. This is only valid when already exists an app instance.

When app is closed, calling it with myapp://param, just opens the app, but doesn't log the whole url scheme!
Code used:

...
// issue: log protocol scheme at first app instance
app.on('will-finish-launching', () => {
  // prints just the executable without protocol scheme
  logEverywhere(process.argv)
})
...

What i am missing?

Did you find a solution for that?

what filename do you mean?

I mean if I pass my custom plist file name instead of an object, electron-builder failed to add those properties in to the info.plist(This feature is available in the electron-packager).

"mac": {
"extendInfo": "myPlist.plist"
}

Is there any other way to read properties from an external file and merge to info.plist?

Did anyone find a solution to reference info.plist filepath in electron builder properties? OR perhaps it only works by providing entries as objects..

Was this page helpful?
0 / 5 - 0 ratings

Related issues

noahprince22 picture noahprince22  Â·  3Comments

ccorcos picture ccorcos  Â·  3Comments

leo picture leo  Â·  3Comments

mstralka picture mstralka  Â·  3Comments

AidanNichol picture AidanNichol  Â·  3Comments