2018-09-14 02:10:51 +10:00
|
|
|
const { app } = require('electron');
|
2017-09-20 11:58:10 +09:00
|
|
|
|
2020-02-03 16:43:22 -06:00
|
|
|
app.whenReady().then(() => {
|
2018-09-14 02:10:51 +10:00
|
|
|
console.log('started'); // ping parent
|
2018-03-07 12:01:17 +09:00
|
|
|
});
|
2017-09-20 11:58:10 +09:00
|
|
|
|
2018-05-08 01:29:18 +10:00
|
|
|
const gotTheLock = app.requestSingleInstanceLock();
|
|
|
|
|
2021-11-04 01:14:09 -07:00
|
|
|
app.on('second-instance', (event, args, workingDirectory) => {
|
2019-03-12 08:56:28 -07:00
|
|
|
setImmediate(() => {
|
2023-06-26 11:51:54 +02:00
|
|
|
console.log(JSON.stringify(args), workingDirectory);
|
2019-03-12 08:56:28 -07:00
|
|
|
app.exit(0);
|
|
|
|
});
|
2017-09-20 11:58:10 +09:00
|
|
|
});
|
|
|
|
|
2018-05-08 01:29:18 +10:00
|
|
|
if (!gotTheLock) {
|
2017-09-20 11:58:10 +09:00
|
|
|
app.exit(1);
|
|
|
|
}
|