Skip to content

Calling BrowserWindow.hide() inside minimize/maximize event in Linux #47446

Closed as not planned

Description

@Devenor

Preflight Checklist

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.

Testcase Gist URL

https://gist.github.com/b3773914d6700575d686f63f1b36f5f4

Additional Information

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.

Activity

  1. added theissue type on Jun 11, 2025
  2. added
    has-repro-gist
    on Jun 11, 2025
  3. moved this to 👀 Unsorted Items in 36-x-yon Jun 11, 2025
  4. nikwen commented on Jun 12, 2025

    @nikwen
    Member

    Thanks for reporting! Would you be able to attach a video showing the bug?

  5. added
    blocked/need-info ❌
    on Jun 12, 2025
  6. Devenor commented on Jun 14, 2025

    @Devenor
    Author

    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
  7. removed
    blocked/need-info ❌
    on Jun 14, 2025
  8. MarshallOfSound commented on Jun 18, 2025

    @MarshallOfSound
    Member

    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

  9. Devenor commented on Jun 18, 2025

    @Devenor
    Author

    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.

  10. moved this from 👀 Unsorted Items to 🛠️ Fixed for Next Release in 36-x-yon Jun 24, 2025
  11. efb4f5ff-1298-471a-8973-3d47447115dc commented on Jun 25, 2025

    @efb4f5ff-1298-471a-8973-3d47447115dc

    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.

    I would like to see a reply to this @MarshallOfSound

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    36-x-ybug 🪲component/BrowserWindowhas-repro-gistplatform/linux

    Type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions