feat: add titlebar to popout window with minimize/maximize/close buttons
- Add window-minimize, window-maximize, window-close, window-is-maximized IPC handlers - Add titlebar with window controls to PopoutPage - Update preload and types for new window control APIs
This commit is contained in:
@@ -491,6 +491,45 @@ ipcMain.handle('create-window', async (_event, tabData: { route: string; title:
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.handle('window-minimize', async (event) => {
|
||||
const win = BrowserWindow.fromWebContents(event.sender);
|
||||
if (win) {
|
||||
win.minimize();
|
||||
return { success: true };
|
||||
}
|
||||
return { success: false };
|
||||
});
|
||||
|
||||
ipcMain.handle('window-maximize', async (event) => {
|
||||
const win = BrowserWindow.fromWebContents(event.sender);
|
||||
if (win) {
|
||||
if (win.isMaximized()) {
|
||||
win.unmaximize();
|
||||
} else {
|
||||
win.maximize();
|
||||
}
|
||||
return { success: true, isMaximized: win.isMaximized() };
|
||||
}
|
||||
return { success: false };
|
||||
});
|
||||
|
||||
ipcMain.handle('window-close', async (event) => {
|
||||
const win = BrowserWindow.fromWebContents(event.sender);
|
||||
if (win) {
|
||||
win.close();
|
||||
return { success: true };
|
||||
}
|
||||
return { success: false };
|
||||
});
|
||||
|
||||
ipcMain.handle('window-is-maximized', async (event) => {
|
||||
const win = BrowserWindow.fromWebContents(event.sender);
|
||||
if (win) {
|
||||
return { success: true, isMaximized: win.isMaximized() };
|
||||
}
|
||||
return { success: false, isMaximized: false };
|
||||
});
|
||||
|
||||
async function startServer() {
|
||||
if (electronState.isDevelopment()) {
|
||||
log.info('In dev mode, assuming external servers are running.');
|
||||
|
||||
@@ -54,4 +54,8 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
||||
terminalGetStatus: () => ipcRenderer.invoke('terminal-get-status'),
|
||||
terminalGetPort: () => ipcRenderer.invoke('terminal-get-port'),
|
||||
createWindow: (tabData: { route: string; title: string }) => ipcRenderer.invoke('create-window', tabData),
|
||||
windowMinimize: () => ipcRenderer.invoke('window-minimize'),
|
||||
windowMaximize: () => ipcRenderer.invoke('window-maximize'),
|
||||
windowClose: () => ipcRenderer.invoke('window-close'),
|
||||
windowIsMaximized: () => ipcRenderer.invoke('window-is-maximized'),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user