I have an Electron based app that runs in the macOS menu bar/the Windows tray area.
On Windows a system shutdown exits the app, but on macOS a system shutdown is interrupted due to the app not closing. How can I detect a shutdown event and close the app when the user has not explicitly requested the app to close?
Simple solution:
import { app, powerMonitor } from 'electron';
powerMonitor.on('shutdown', () => {
app.quit();
});