- Add window handlers for minimize, maximize, close, and check if maximized in ipcMain. - Update preload script to use new window control IPC events. - Refactor window service to remove old IPC event handlers and use new handlers. - Remove old HeaderBar and DragRegion components, replacing them with a new TitleBar component. - Update Layout component to use TitleBar instead of HeaderBar. - Remove useWinManager hook as its functionality is now integrated into TitleBar. - Update login page to remove HeaderBar and adjust layout accordingly. - Update constants to remove old window IPC events. - Update package dependencies to replace @iconify/vue with @lucide/vue.
24 lines
534 B
TypeScript
24 lines
534 B
TypeScript
import { ipcMain, BrowserWindow } from 'electron';
|
|
|
|
export function registerWindowHandlers(mainWindow: BrowserWindow): void {
|
|
ipcMain.handle('window:minimize', () => {
|
|
mainWindow.minimize();
|
|
});
|
|
|
|
ipcMain.handle('window:maximize', () => {
|
|
if (mainWindow.isMaximized()) {
|
|
mainWindow.unmaximize();
|
|
} else {
|
|
mainWindow.maximize();
|
|
}
|
|
});
|
|
|
|
ipcMain.handle('window:close', () => {
|
|
mainWindow.close();
|
|
});
|
|
|
|
ipcMain.handle('window:isMaximized', () => {
|
|
return mainWindow.isMaximized();
|
|
});
|
|
}
|