electron: currentWindow.maximize() doesn't truly maximize the window
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for an issue that matches the one I want to file, without success.
Issue Details
- Electron Version: Electron 6.0.4
- Operating System: Windows 10 (1903)
Expected Behavior
The maximize() function maximizes the window as it would any other window.
Actual Behavior
The maximize() function “maximizes” the window, but doesn’t give it the maximized property. The window is still resizable via the edges of the app.
To Reproduce
Have an app with a custom title bar emit the maximize() function on a custom placed maximize button. The properties of the window should be frame: false
and transparent: false
.
Additional Information
The general concept of the custom titlebar with buttons is taken from a repository found here: https://github.com/maxchaor/electron-title-bar-tutorial The repository in question uses Electron 2.0.0 to run it.
This issue isn’t present on every device. It’s been tested on three of my own systems and it works fine on there.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 10
- Comments: 42 (1 by maintainers)
If you want to first use setResizable(false) and next time change it to setResizable(true) , you can use following code as replacement :
First time:
Next time:
above code worked very good for me .
Guys,I found this, after you “setResizable(false)” or “new BrowserWindow({resizable: false})”,then “isMaximized()” will always return “false”,even if you execute “setResizable(true)”.
So if you want “isMaximized()” to return the result correctly, make sure “resizable” is true always.
You must include the above configuration, win.isMaximized() and win.unmaximize() to work properly.
electron:6.0.2 system:win10
@Z3RoMan yeah, but the weird thing is, for me it worked properly in v4.1.5, the
isMaximized()
function has been returningtrue
in the maximized state, with the same config: