-
Notifications
You must be signed in to change notification settings - Fork 344
is window maximized? #400
Comments
This information is not accessible through this lib |
how would I implement a maximize/restore button then |
@tizu69 You can create buttons on your frontend that can send a command to Go via go-astilectron-bootstrap can help with this as it provides with a simple way to read the message received and process them with your own handler. The following snippets should help you if you use go-astilectron-bootstrap and need some frontend buttons to do certain actions such as hiding/closing a window: //JS
astilectron.sendMessage({
name: "minimize",
}, function (message) {
console.log("Closed " + message)
}); //GO
window.Hide() //to hide the window
window.Minimize() //to minimize the window |
I also figured that out by not, but I'm not sure how to implement a button that maximizes or restores the window, depending on if it's currently maximized |
@tizu69 you can check the current status of the window with the following (got it from the docs and tested it works in my app): const { BrowserWindow } = require("electron").remote;
var win = BrowserWindow.getFocusedWindow();
if (win.isMaximized()) {
console.log("window is maximized")
} else {
console.log("window not maximized")
} |
thanks! |
hol up, I actually got an issue. Remote isn't available for the version of electron anymore that I'm forced to use (due to Chromium version requirement), so I was told to use the @electron/remote package, but this requires init: is there a way to init this from go-astilectron? All I'd need is to run that one snippet in the main function and I should be good to go. |
I'm assuming this isn't possible? |
You could maybe install the library into astilectron and try to call the library from your app's JS or maybe run the navbar code through a preload.js that is loaded in via Go. I am not 100% sure on which solution will work as I don't use the latest electron due to some issues I get with go-astilectron. |
how do I get this
The text was updated successfully, but these errors were encountered: