Window event "unmaximize" not triggered upon unmaximize.
See original GitHub issueSpecs:
- Windows 10
- NW.JS 0.14.4 SDK
I’m using frameless Window, so I have to create my own window buttons. My app is for Windows OS only and below is my implementation of the idea.
$(".win-max-btn").click(function() {
if (!win.isMaximized)
win.maximize();
else
win.unmaximize();
});
win.on("maximize", function(){
$(".win-max-btn").find("i").attr("class", "ws ws-restore"); //change the button's icon
win.isMaximized = true;
});
win.on("unmaximize", function(){
$(".win-max-btn").find("i").attr("class", "ws ws-maximize"); //change the button's icon
win.isMaximized = false;
});
The problem is The button is changed to the “restore” icon when maximized and win.isMaximized
is set to true, but when I unmaximize the window through mean of clicking the button or dragging the “window frame area” down, the window is unmaximized but the icon isn’t changed because the event unmaximize
was never triggered.
I have tested with the event restore
is it did work and was triggered when the window was unmaximized but that isn’t what I want.
So if I read the docs right, the event unmaximize
might be bugged?
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
electron win.unmaximize(); not working - Stack Overflow
Instead of unmaximize use restore as below, it will work. $('#maximize').click(function() { if(win.isMaximized()){ win.restore(); }else{ ...
Read more >Window - NW.js Documentation
Restore window to previous state after the window is minimized, i.e. the reverse of minimize() . It's not named unminimize since restore is...
Read more >Window: beforeunload event - Web APIs | MDN
The beforeunload event is fired when the window, the document and its resources are about ... so as to minimize the effect on...
Read more >Unexplained Windows or software behavior may be caused ...
Components of Windows or other programs no longer work. ... You can use the restore point to restore to the computer configuration that...
Read more >app | Electron
Note: On Windows, this event will not be emitted if the app is closed due to a ... Various actions can trigger this...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There is an error in the document, we’ll fix it soon.
NWjs has no
isMaximized
you must usechrome.app.window.current().isMaximized()
Use
restore
instead ofunmaximize
unmaximize and leave-fullscreen events of Window object is deprecated and replaced by restore. When window is restored from minimized, maximized or fullscreen, restore event is triggered instead.