How do you detect is screen is in fullscreen or windowed

Godot Version

4.2.1

Question

I have been searching for a wile how to detct if the screen is in fullscreen or in windowed but I can’t seem to find anything. Can anyone help me please.

On G3:
OS.window_fullscreen will return the state.

On G4 there seen to be another way that is not that direct.

can’t seem to find the function

For Godot 4 use:

DisplayServer.window_get_mode()

**

yeah I tried that but when I print_debug it it gives me a number

**

Yes it’s an enum, see here

2 Likes

Is there also a signal for when this a change in window mode happens? It seems not. If I’m in my settings screen and want the fullscreen toggle on there to react to fullscreen events from the OS (eg. you press the maximize button) then the only way to do that is to poll the window mode for changes, right?