Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Closing an Electron App on Darwin

IIUC the following code will stop the app's electron process on all OSs except Apples (Darwin):

app.on('window-all-closed', () => {
    if (process.platform != 'darwin') {
        app.quit();
    }
})

How do we ensure that the process running the app also stops on Darwin?

like image 225
Ole Avatar asked Dec 31 '25 10:12

Ole


1 Answers

If I am not mistaken, excluding darwin platform is just to replicate that OS behaviour: on Windows and Linux, the convention is to terminate (quit) the software when a user closes its window; whereas on macOS, the convention is to keep the process in background.

There is nothing preventing you from breaking that convention and to make quit the app when the user closes the window.

like image 133
ghybs Avatar answered Jan 06 '26 00:01

ghybs



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!