Switching mode from full screen to windowed

Godot Version

Godot 4.6 Win10

Question

You all know the code to switch from full screen to window mode

if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN:
		DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
	else:
		DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)

Problem is that this code does nothing for me.
If I click the button to trigger the code, screen flickers, but nothing changes.
What am I missing?
I start at full screen.

My guess is that you have embedded play enabled.
You might see the following message in the editor:
Embedded window only supports Windowed mode.

You simply need to disable embedded play to be able to go full screen.