Skip to content

Commit ce30fcb

Browse files
author
Jalileh
committed
Deleting current workspace switches to another instead of closing
1 parent 0925af5 commit ce30fcb

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

emain/emain-window.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,9 +699,23 @@ ipcMain.on("delete-workspace", (event, workspaceId) => {
699699
console.log("user cancelled workspace delete", workspaceId, ww?.waveWindowId);
700700
return;
701701
}
702+
703+
if (workspaceList.length > 1 && ww?.workspaceId == workspaceId){
704+
705+
const workspaceIdindex : any = workspaceList.findIndex(wse => wse.workspaceid === workspaceId);
706+
707+
const moveIndex = (workspaceIdindex > 1) ? workspaceIdindex - 1 : workspaceIdindex + 1;
708+
const PrevNextWorkspace : any = workspaceList[moveIndex]
709+
710+
await ww.switchWorkspace(PrevNextWorkspace.workspaceid);
711+
relaunchBrowserWindows(); // the blank window bug from 0.10.1 OCCASIONALLY occurs if this is not here, ( issue #1567 )
712+
}
713+
702714
await WorkspaceService.DeleteWorkspace(workspaceId);
715+
703716
console.log("delete-workspace done", workspaceId, ww?.waveWindowId);
704-
if (ww?.workspaceId == workspaceId) {
717+
718+
if (ww?.workspaceId == workspaceId) {
705719
console.log("delete-workspace closing window", workspaceId, ww?.waveWindowId);
706720
ww.destroy();
707721
}

0 commit comments

Comments
 (0)