You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
.isMaximized() always returns false even when window is maximized. #9092
I believe transparent=true is the root cause. Once the window is maximized, it will never unmaiximzed. I set my HTML window to be draggable, so that I can show the Window's context menu, which is usually available by right clicking the original Window titlebar. Now I can see that the menu item "Maximize" (in the Window's context menu) is by default bold. It is expected to be disabled.
(I'm using 1.7.4 beta)
Reacted by Kerwin Bryant, Ren, André Colli, Chiru, 之梦, Braulio Herrera, SCate, YaoYijie and Norris Lau
I have the same issue too. it sucks. and your Workaround is not complete. What is when you max the windows and you resize it from the border?! than you have a non maxi window with TMP = true. but that is wrong! We need a fixed function please.
@MeinLieblingsmensch Yes, I've already thought of that. nevertheless only a transitional solution.
I agree with @Trackhe there needs to be a fix to this
However, you can determine the maximum resolution size of the application and let that determine if your window needs to be maximized or minimized/unmaximized.
Same issue here: new BrowserWindow({width:1240, height: 820,icon: 'favicon.ico', frame: false, webPreferences: {nodeIntegration: true, webviewTag: true}});
But additionally the functions win.unmaximize() is not working.
So i can maximize the window but can not unmaximize it.
I do not have this problem in the electron version 4.1.3.
But on every following version i have this issue.
One of the problems with this not being fixed might be because of this issue being closed. The issue is definitely not resolved. I'd say that this issue should be reopened.
Reacted by Oen44, Lena Emme, cadiron, Robby Lucia, Lennart Hase, ddbrandonb, whereishappiness, Daniel Baumeister and Danny Feliz
Found the same problem with Electron 9.2.0 -- after you specify the transparent flag to true, isMaximized method starts to return false for every call.
I'm still having issues getting a reliable value back in terms of maximised state, but I found that creating a stored local state can get around this, instead of relying on the function returning something correct.
From there, I just call the window.setSize and window.setPosition functions to actually restore a window - spent way too long messing around with something that should be so simple and built in.
Activity
FullstackDevsYT commentedon Apr 7, 2017
it seems to be working now
yjlintw commentedon May 5, 2017
I still have the same problem on Win10.
electron version: v1.6.8I'm using frameless window. Is that the issue?
stanleyxu2005 commentedon Jul 12, 2017
I believe
transparent=trueis the root cause. Once the window is maximized, it will never unmaiximzed. I set my HTML window to be draggable, so that I can show the Window's context menu, which is usually available by right clicking the original Window titlebar. Now I can see that the menu item "Maximize" (in the Window's context menu) is by default bold. It is expected to be disabled.(I'm using 1.7.4 beta)
kerwin612 commentedon Sep 3, 2017
@stanleyxu2005 +1,frameless window set
transparent=true-> .isMaximized(); always returns false;electron: v1.7.5
ErickRodrCodes commentedon Nov 21, 2017
@stanleyxu2005 +1: if frameless window is set to
transparent:true, win.isMaximized() will return always false. Electron 1.7.0AndreColli commentedon Nov 29, 2017
@stanleyxu2005 +1
Same issue here.
w10 | electron v1.7.9
itsezc commentedon Dec 20, 2017
@stanleyxu2005 @FullstackDevsYT Same issue
Windows 10 | Electron 1.7.x and 1.8.x
Work around:
Basic... but that's all I needed.
P.S. this expects your application to be maximized, if its not maximized by default be sure to have this instead:
var TMP = { maximized: false }DannyFeliz commentedon Mar 27, 2018
I ended with a similar solution as @MeinLieblingsmensch I hope someone fix this.
stanleyxu2005 commentedon Mar 27, 2018
@FullstackDevsYT please reopen this ticket, as it is actually not working.
Trackhe commentedon May 13, 2018
I have the same issue too. it sucks. and your Workaround is not complete. What is when you max the windows and you resize it from the border?! than you have a non maxi window with TMP = true. but that is wrong! We need a fixed function please.
@MeinLieblingsmensch Yes, I've already thought of that. nevertheless only a transitional solution.
itsezc commentedon May 13, 2018
I agree with @Trackhe there needs to be a fix to this
However, you can determine the maximum resolution size of the application and let that determine if your window needs to be maximized or minimized/unmaximized.
abalad commentedon May 30, 2018
In the previous version I used the following code:
But in the current version it does not work anymore :(
The code
mainWindow.isMaximized()always returnsFALSEititchuan commentedon Apr 16, 2019
electorn:4.0.0+win10,new BrowserWindow({ width: 800, height: 600,frame: false,titleBarStyle: 'hidden',titleBarStyle: 'customButtonsOnHover',
transparent:true,hasShadow:false}).Still having problems.
Kyza commentedon Apr 24, 2019
It has been over 2 years and this issue has still not been fixed. Hopefully, we will get one by 5.0.
2 remaining items
Feuerhamster commentedon Sep 13, 2019
Same issue here:
new BrowserWindow({width:1240, height: 820,icon: 'favicon.ico', frame: false, webPreferences: {nodeIntegration: true, webviewTag: true}});But additionally the functions
win.unmaximize()is not working.So i can maximize the window but can not unmaximize it.
I do not have this problem in the electron version
4.1.3.But on every following version i have this issue.
JustGogoing commentedon Sep 21, 2019
version 6.0.0
Still issue in my app
JohnGagliardi commentedon Sep 25, 2019
Broken for me as well. The IsMaximixed() issue is causing unmaximize to not run from what I can tell;
I have a static window size so I have the following work around:
NOTE: I am working in React which is where the state comes from
Kyza commentedon Sep 30, 2019
One of the problems with this not being fixed might be because of this issue being closed. The issue is definitely not resolved. I'd say that this issue should be reopened.
zouye commentedon Oct 15, 2019
Electron: 6.0.10
这个是是我的版本,依旧没有解决。但是在4.x版本中是好的。官方什么时候修复
Darkzarich commentedon Aug 13, 2020
The problem still persists
Nerlin commentedon Aug 17, 2020
Found the same problem with Electron 9.2.0 -- after you specify the
transparentflag to true, isMaximized method starts to return false for every call.Darkzarich commentedon Aug 17, 2020
This is what I ended up with for my case, I only needed to know if it's minimized right now or not:
I defined my own property which I placed in
mainWindowobject (BrowserWindowclass object), it gets changed on needed events which works pretty goodand I access it like that in my app:
DannyFeliz commentedon Aug 17, 2020
cc @codebytere
zhangxuelian commentedon Oct 22, 2020
version 10.1.1
Still issue in my app
snowInCloudy commentedon Mar 30, 2022
version 10.1.3
The problem still persists
codebytere commentedon Mar 30, 2022
Yes, correct. version 10 is not supported any longer and does not have this fix.
OldManMeta commentedon Apr 23, 2023
This is still and issue.
DannyFeliz commentedon Apr 24, 2023
Your comment just turned 4 years old and this is still a problem 😄
OldManMeta commentedon Apr 24, 2023
I'm still having issues getting a reliable value back in terms of maximised state, but I found that creating a stored local state can get around this, instead of relying on the function returning something correct.
From there, I just call the window.setSize and window.setPosition functions to actually restore a window - spent way too long messing around with something that should be so simple and built in.