-
Notifications
You must be signed in to change notification settings - Fork 610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v1.0, chore, ui] close processes when window closes #584
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,11 +129,11 @@ const createChat = async (app, query?: string, dir?: string, version?: string) = | |
if (checkApiCredentials()) { | ||
return startGoosed(app, dir); | ||
} else { | ||
return [0, '', '']; | ||
return [0, '', null]; | ||
} | ||
} | ||
|
||
const [port, working_dir, agentVersion] = await maybeStartGoosed(); | ||
const [port, working_dir, goosedProcess] = await maybeStartGoosed(); | ||
|
||
const mainWindow = new BrowserWindow({ | ||
titleBarStyle: 'hidden', | ||
|
@@ -152,7 +152,6 @@ const createChat = async (app, query?: string, dir?: string, version?: string) = | |
...appConfig, | ||
GOOSE_SERVER__PORT: port, | ||
GOOSE_WORKING_DIR: working_dir, | ||
GOOSE_AGENT_VERSION: agentVersion, | ||
REQUEST_DIR: dir | ||
})], | ||
}, | ||
|
@@ -192,6 +191,13 @@ const createChat = async (app, query?: string, dir?: string, version?: string) = | |
mainWindow.on('closed', () => { | ||
windowMap.delete(windowId); | ||
}); | ||
|
||
mainWindow.on('closed', () => { | ||
if (goosedProcess) { | ||
goosedProcess?.kill(); | ||
} | ||
}); | ||
|
||
}; | ||
|
||
const createTray = () => { | ||
|
@@ -207,7 +213,6 @@ const createTray = () => { | |
const tray = new Tray(iconPath); | ||
|
||
const contextMenu = Menu.buildFromTemplate([ | ||
{ label: 'Show Window', click: showWindow }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we dropping this option. Wouldn't the remaining context menu just have a separator and then the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah - but I don't think it did anything? (it was a relic from wing to wing I think?) - but could check that out again |
||
{ type: 'separator' }, | ||
{ label: 'Quit', click: () => app.quit() } | ||
]); | ||
|
@@ -216,39 +221,6 @@ const createTray = () => { | |
tray.setContextMenu(contextMenu); | ||
}; | ||
|
||
const showWindow = () => { | ||
const windows = BrowserWindow.getAllWindows(); | ||
|
||
if (windows.length === 0) { | ||
log.info("No windows are currently open."); | ||
return; | ||
} | ||
|
||
// Define the initial offset values | ||
const initialOffsetX = 30; | ||
const initialOffsetY = 30; | ||
|
||
// Iterate over all windows | ||
windows.forEach((win, index) => { | ||
const currentBounds = win.getBounds(); | ||
const newX = currentBounds.x + initialOffsetX * index; | ||
const newY = currentBounds.y + initialOffsetY * index; | ||
|
||
win.setBounds({ | ||
x: newX, | ||
y: newY, | ||
width: currentBounds.width, | ||
height: currentBounds.height, | ||
}); | ||
|
||
if (!win.isVisible()) { | ||
win.show(); | ||
} | ||
|
||
win.focus(); | ||
}); | ||
}; | ||
|
||
const buildRecentFilesMenu = () => { | ||
const recentDirs = loadRecentDirs(); | ||
return recentDirs.map(dir => ({ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why can't this be t same block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably as I was tired abnd missed it!