Electron: investigate to use `requestSingleInstanceLock()` API
See original GitHub issueCurrently VSCode is implementing it’s own solution for preventing a second instance from starting. Electron provides API to do the same but there are differences: https://github.com/electron/electron/blob/7-1-x/docs/api/app.md#apprequestsingleinstancelock
Things we need:
- pass the process environment over (https://github.com/electron/electron/issues/18434)
- communicate between second and first instance to support
code --status
[1]
[1] code --status
will print information about the active window in the first instance to the console of the second instance and thus requires access to the workspace, including remote scenarios.
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (13 by maintainers)
Top Results From Across the Web
How to use the electron.app.on function in electron - Snyk
To help you get started, we've selected a few electron.app.on examples, based on ... requestSingleInstanceLock() if (!gotTheLock) { app.quit() } else ...
Read more >How to Code a Desktop App Using Electron
Let's talk about Electron, examine what can it be used for, and how to build a desktop app with it.
Read more >Interop's Labyrinth: Sharing Code Between Web & Electron ...
Things aren't always what they seem in this place, so you can't take anything for ... and access to exciting new APIs like...
Read more >How to prevent multiple instances in Electron - Stack Overflow
There is a new API now: requestSingleInstanceLock const { app } = require('electron') let myWindow = null const gotTheLock = app.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Adding @bpasero comments about the benefits from using the API:
Good catch, maybe the API can provide an option to allow this default behavior or abort and surface as error to users.