Make Window close button invisible

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By OTGOD

In Godot 4, is there any way to make the Window close button invisible?

I confess I tried one thing that eventually worked but I don’t know if this is the correct way to do it: I styled the close button icon with a 0x0 PlaceholderTexture2D. This completely removes the button.

But this smells like fish spirit. :smiley:

:bust_in_silhouette: Reply From: BoxyLlama

One option you could consider is turning off the default OS control bar, and build your own without a close button.

To turn off the default OS control bar, you can go to Project Settings > Display > Window > Borderless. Check the borderless box. This would remove the default OS Buttons and Border.

The next step would be to add back the controls you do want. Whether that’s an actual invisible Close button, or not close button at all as well as a top bar for drag movement and the minimize / maximize buttons if you want them.

Maybe I forgot to mention this is not the main Window: it is a popup presented to users (they must insert their nickname and click a button. So basically, the window is a little popup with a textfiled (lineedit and a button). The only thing I don’t need is the close button (of course, it could mean “cancel”, but I don’t really need it)

OTGOD | 2023-05-04 09:35

Ah! That’s alright, because the same idea could still be used.

Assuming you’re using a “Window” node, you can go to Flags > Borderless and check the box. Then you can add your own custom border / header for anything you do want to support in the window.

BoxyLlama | 2023-05-04 14:43

I did not know it: I will try your solution as soon as possible. In the meantime, thank you :slight_smile:

OTGOD | 2023-05-07 08:45