mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
Close a window automatically when the last tab is closed (#131)
This commit is contained in:
@@ -217,6 +217,15 @@ async function handleWSEvent(evtMsg: WSEventType) {
|
||||
const newWin = createBrowserWindow(clientData.oid, windowData);
|
||||
await newWin.readyPromise;
|
||||
newWin.show();
|
||||
} else if (evtMsg.eventtype == "electron:closewindow") {
|
||||
if (evtMsg.data === undefined) return;
|
||||
const windows = electron.BrowserWindow.getAllWindows();
|
||||
for (const window of windows) {
|
||||
if ((window as any).waveWindowId === evtMsg.data) {
|
||||
// Bypass the "Are you sure?" dialog, since this event is called when there's no more tabs for the window.
|
||||
window.destroy();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.log("unhandled electron ws eventtype", evtMsg.eventtype);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user