Close a window automatically when the last tab is closed (#131)

This commit is contained in:
Evan Simkowitz
2024-07-22 16:39:45 -07:00
committed by GitHub
parent 1c99e1ed4c
commit b2ee164b85
3 changed files with 15 additions and 2 deletions
+5 -2
View File
@@ -67,10 +67,13 @@ func (svc *WindowService) CloseTab(ctx context.Context, uiContext wstore.UIConte
var newActiveTabId string
if len(ws.TabIds) > 0 {
newActiveTabId = ws.TabIds[0]
wstore.SetActiveTab(ctx, uiContext.WindowId, newActiveTabId)
} else {
newActiveTabId = ""
eventbus.SendEventToElectron(eventbus.WSEventType{
EventType: eventbus.WSEvent_ElectronCloseWindow,
Data: uiContext.WindowId,
})
}
wstore.SetActiveTab(ctx, uiContext.WindowId, newActiveTabId)
}
return wstore.ContextGetUpdatesRtn(ctx), nil
}