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
Calling BrowserWindow.hide() inside minimize/maximize event in Linux #47446
I agree to follow the Code of Conduct that this project adheres to.
I have searched the issue tracker for a bug report that matches the one I want to file, without success.
Electron Version
36.4.0
What operating system(s) are you using?
Ubuntu
Operating System Version
Ubuntu 24.04.2 LTS and 25.04
What arch are you using?
x64
Last Known Working Electron version
No response
Expected Behavior
After hiding a window by overriding the default minimize or maximize events, it should maintain the expected behaviour when dragging it or clicking the button corresponding to a non overriden event.
Actual Behavior
After showing the window again, when clicking and dragging the title bar or clicking the maximize button if the minimize event has been overriden, or the minimize button if the maximize button has been overriden, the window will hide itself.
There's a workaround in the Fiddle too, it may help you find the issue. Just comment out lines 13 to 17 in main.js and uncomment lines 20 to 25. The timer at line 23 may vary, I've found that in my PC it works with 100ms, but in another PC with the same Ubuntu version (both in VMs) it has to be increased.
Sure, here's a clip from the app we are testing. The hide method is called when clicking the minimize button. Afterward, you can see that when trying to move the window or maximize it, it hides again instead.
Calling alternative APIs within the minimize event doesn't "cancel" the event, not surprised this is doing strange things. To achieve what you want you'll need to actually hook the minimize event natively for each platform and actually prevent it to ensure window managers do not get confused.
Closing this out as preventing these minimize events and such is not a supported use case
But it works fine in Windows. Also, one would expect that if the window manager were getting confused, it would only affect the minimize event, not the maximize or the window dragging behavior. And it doesn't necessarily need to cancel the event, the window could be minimized and then hidden, or hidden and then minimized.
Hiding when minimizing isn't uncommon. Thunderbird for example does the same when enabling the When Thunderbird is minimized, move it to the tray option, as many other apps.
But it works fine in Windows. Also, one would expect that if the window manager were getting confused, it would only affect the minimize event, not the maximize or the window dragging behavior. And it doesn't necessarily need to cancel the event, the window could be minimized and then hidden, or hidden and then minimized.
Hiding when minimizing isn't uncommon. Thunderbird for example does the same when enabling the When Thunderbird is minimized, move it to the tray option, as many other apps.
Activity
nikwen commentedon Jun 12, 2025
Thanks for reporting! Would you be able to attach a video showing the bug?
Devenor commentedon Jun 14, 2025
Sure, here's a clip from the app we are testing. The hide method is called when clicking the minimize button. Afterward, you can see that when trying to move the window or maximize it, it hides again instead.
451353489-9b5c6037-13df-40f6-8ce3-7aea0c2654d8.mp4
MarshallOfSound commentedon Jun 18, 2025
Calling alternative APIs within the
minimizeevent doesn't "cancel" the event, not surprised this is doing strange things. To achieve what you want you'll need to actually hook the minimize event natively for each platform and actually prevent it to ensure window managers do not get confused.Closing this out as preventing these minimize events and such is not a supported use case
Devenor commentedon Jun 18, 2025
But it works fine in Windows. Also, one would expect that if the window manager were getting confused, it would only affect the minimize event, not the maximize or the window dragging behavior. And it doesn't necessarily need to cancel the event, the window could be minimized and then hidden, or hidden and then minimized.
Hiding when minimizing isn't uncommon. Thunderbird for example does the same when enabling the When Thunderbird is minimized, move it to the tray option, as many other apps.
efb4f5ff-1298-471a-8973-3d47447115dc commentedon Jun 25, 2025
I would like to see a reply to this @MarshallOfSound