improve window management and title bar

This commit is contained in:
talksik
2026-02-21 12:42:43 -08:00
parent 59b973802d
commit 8546260493
26 changed files with 229 additions and 25 deletions
+19 -1
View File
@@ -1,4 +1,4 @@
import { app, BrowserWindow, session } from 'electron';
import { app, BrowserWindow, ipcMain, session } from 'electron';
import path from 'node:path';
import started from 'electron-squirrel-startup';
@@ -12,6 +12,8 @@ const createWindow = () => {
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
resizable: false,
frame: false,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
},
@@ -30,6 +32,22 @@ const createWindow = () => {
mainWindow.webContents.openDevTools();
};
// Window control IPC handlers
ipcMain.on('window:minimize', (event) => {
BrowserWindow.fromWebContents(event.sender)?.minimize();
});
ipcMain.on('window:maximize', (event) => {
const win = BrowserWindow.fromWebContents(event.sender);
if (win?.isMaximized()) {
win.unmaximize();
} else {
win?.maximize();
}
});
ipcMain.on('window:close', (event) => {
BrowserWindow.fromWebContents(event.sender)?.close();
});
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.