- is there any way to create an electron app that have multiple windows(sub app) all with different icons, titles etc but common main process.
You can not do that (I mean different icons). Although in Windows/Linux you can use
browserWindow.setIcon, but it has no effect in Mac.
But you can have a shared main process for sub-apps. Check my answer below.
- if no then will I have to create multiple app for this package. I mean all the dists of electron have a lot of common files can i share these file between all the apps of that package.
You can achieve this by the following steps:
Electron itself is an example that it has a default_app to transfer it into different apps: https://github.com/electron/electron/tree/master/default_app, you can use the same way to boot your sub apps, just write your share code (common main process) in your default_app. (The key point is the
loadApplicationPackage function: https://github.com/electron/electron/blob/master/default_app/main.js#L242)
child_process.spawn to spawn a
electron.app.getPath('exe'). This will eventually go to the default_app in step 1, then parse the
process.argv and extract your sub-app argument from it. (Well, i think how to boot it is up to you, you can skip this step)
Since you are boot your sub-app through default_app, you can change the app’s icon through
app.dock.setIcon in Mac,