Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify own Info.plist file and create desktop shortcut icon? #549

Closed
changkun opened this issue Jun 29, 2016 · 16 comments
Closed

Specify own Info.plist file and create desktop shortcut icon? #549

changkun opened this issue Jun 29, 2016 · 16 comments
Labels

Comments

@changkun
Copy link
Contributor

changkun commented Jun 29, 2016

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

@changkun changkun changed the title Specify own Info.plist file Specify own Info.plist file and create desktop shortcut icon? Jun 29, 2016
@develar
Copy link
Member

develar commented Jun 29, 2016

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

@develar
Copy link
Member

develar commented Jun 29, 2016

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.

@changkun
Copy link
Contributor Author

@develar thx a lot~

@oikonomopo
Copy link

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)?

@oikonomopo
Copy link

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?

@oikonomopo
Copy link

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

@oikonomopo
Copy link

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

@develar
Copy link
Member

develar commented May 15, 2017

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

@oikonomopo
Copy link

oikonomopo commented May 18, 2017

Thanks!

@sanoop-jose
Copy link

sanoop-jose commented Jul 25, 2018

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?

@develar
Copy link
Member

develar commented Jul 25, 2018

@sanoop-jose

the file name into extendInfo?

what filename do you mean?

@sanoop-jose
Copy link

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?

@hacdias
Copy link

hacdias commented Mar 13, 2019

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?

@johnnysparav
Copy link

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

@OfekA-IAI
Copy link

OfekA-IAI commented May 17, 2022

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

I assume you can just read the file, parse it, make an object out of it and pass it to extendInfo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants