Use native Windows title bar
All checks were successful
Build Windows App / build-windows (push) Successful in 22m0s

This commit is contained in:
MrSphay
2026-05-01 21:14:41 +02:00
parent 03407feeb9
commit 4e1d0157f1
5 changed files with 4 additions and 175 deletions

View File

@@ -5,8 +5,6 @@ import { fileURLToPath } from "node:url";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
let mainWindow: BrowserWindow | null = null;
async function createWindow() {
const win = new BrowserWindow({
width: 1220,
@@ -14,7 +12,7 @@ async function createWindow() {
minWidth: 980,
minHeight: 680,
title: "EnvHelper",
frame: false,
frame: true,
autoHideMenuBar: true,
backgroundColor: "#f6f7f4",
webPreferences: {
@@ -24,13 +22,6 @@ async function createWindow() {
}
});
mainWindow = win;
win.on("closed", () => {
if (mainWindow === win) {
mainWindow = null;
}
});
Menu.setApplicationMenu(null);
if (!app.isPackaged) {
@@ -57,27 +48,6 @@ ipcMain.handle("envhelper:open-file", async () => {
};
});
ipcMain.on("envhelper:window-minimize", () => {
mainWindow?.minimize();
});
ipcMain.on("envhelper:window-toggle-maximize", () => {
if (!mainWindow) {
return;
}
if (mainWindow.isMaximized()) {
mainWindow.unmaximize();
return;
}
mainWindow.maximize();
});
ipcMain.on("envhelper:window-close", () => {
mainWindow?.close();
});
ipcMain.handle("envhelper:save-file", async (_event, content: string) => {
const result = await dialog.showSaveDialog({
defaultPath: ".env",

View File

@@ -2,8 +2,5 @@ import { contextBridge, ipcRenderer } from "electron";
contextBridge.exposeInMainWorld("envHelper", {
openFile: () => ipcRenderer.invoke("envhelper:open-file"),
saveFile: (content: string) => ipcRenderer.invoke("envhelper:save-file", content),
minimizeWindow: () => ipcRenderer.send("envhelper:window-minimize"),
toggleMaximizeWindow: () => ipcRenderer.send("envhelper:window-toggle-maximize"),
closeWindow: () => ipcRenderer.send("envhelper:window-close")
saveFile: (content: string) => ipcRenderer.invoke("envhelper:save-file", content)
});