-
-
Notifications
You must be signed in to change notification settings - Fork 58
Not working on electron version 14.0.0 #40
Comments
Same hear, does not work. |
It's not working on version 14 cause remote was remove. Check this post : electron/electron#21408 |
Happy to accept a PR to get it working on more recent versions of Electron, but don't have much time to work on this myself |
I found a solution but I don't know if it's a proper way... I share in case someone wanna try it. Install @Remote package : https://www.npmjs.com/package/@electron/remote and this one after "mainWindow" implementation : Change require in renderer.js by : |
Yes, I was aware of this and it truly has been a fucking pain to me, mainly because I'm stupid and don't understand |
Ok so I have made fork on my other GitHub where I have fixed this problem |
Thank you for your work, I repost your link (is broken "titlebat => titlebar") : |
This is how it would work with In //Minimise the app
ipc.on("minimiseApp", () => {
console.log("Clicked Minimise button!");
mainWindow.minimize();
});
// Maximize Restore App
ipc.on("maximizeRestoreApp", () => {
if (mainWindow.isMaximized()) {
console.log("Clicked on Restore");
mainWindow.restore();
} else {
console.log("Clicked on Maximize");
mainWindow.maximize();
}
});
//Check if maximized
mainWindow.on("maximize", () => {
mainWindow.webContents.send("isMaximized");
});
// Check if is restored
mainWindow.on("unmaximize", () => {
mainWindow.webContents.send("isRestored");
});
//Close the app
ipc.on("closeApp", () => {
console.log("Clicked Close button!");
mainWindow.close();
});
const { ipcRenderer } = require("electron");
const ipc = ipcRenderer;
// Minimise app
minBtn.addEventListener("click", () => {
ipc.send("minimiseApp");
});
//Maximize Restore App
maxBtn.addEventListener("click", () => {
ipc.send("maximizeRestoreApp");
});
//Close app
closeBtn.addEventListener("click", () => {
ipc.send("closeApp");
}); Credit to Wanderson on YouTube, I watched this video of his to get it to work. |
I put up a pull request @binaryfunt |
The solution is very simple: 1.) Install @electron/remote 2.) add after mainWindow.loadFile(..) in main,js
3.) replace the content in renderer.js to:
|
The minimize, maximize, and close functions don't working on version 14.0.0.
The text was updated successfully, but these errors were encountered: