Maximized window with windows taskbar

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

Hello,
I’m a beginner in Godot and I’m trying to create a non-gaming application. I want to ask you if there is a way how to create a maximized borderless window with the windows taskbar? Thank you for your help.

:bust_in_silhouette: Reply From: Gluon

You should be able to put this as the first line of code in your main scene

OS.set_window_maximized(true)

within the ready function and it should do the trick

Thank you for your answer. I tried to use your code, but the window set to fullscreen mode. Press to link below you will see my settings.
https://imgway.cz/s/d51y

Dolpi | 2022-02-14 11:59

Oh well the only way I would know to do that is to set the specific window size you would want like this

OS.set_window_size(Vector2(1920, 1080))

which would set the window to that size.

Gluon | 2022-02-14 12:49

I set OS.set_window_size(Vector2(1920, 1040)). (Windows taskbar in Windows 10 is 40 pixels height). It really works, but after resizing the appliacation doesn’t appear in the middle of the screen. Press to links below you can see pictures. Is there a way how to fix it?

Before resizing (1280x720)
Down for Maintenance

After resizing (1920x1040)
Down for Maintenance

Dolpi | 2022-02-14 13:32

Well you could use this

OS.set_window_position(OS.get_screen_size()*0.5 - OS.get_window_size()*0.5)

to center the window

Gluon | 2022-02-15 08:58

If you have multiple screens you will need to do this

OS.set_window_position(
        OS.get_screen_position(OS.get_current_screen()) + 
        OS.get_screen_size()*0.5 - OS.get_window_size()*0.5)

otherwise it will center it across both screens.

Gluon | 2022-02-15 09:10

It’s almost perfect. Just top side of application window wants to move 20 pixels higher.

After resizing:
Down for Maintenance

Dolpi | 2022-02-15 14:48

glad it worked for you

Gluon | 2022-02-15 14:59

Thank you very much.

Dolpi | 2022-02-16 22:53

if you are setting the window size then you have to take into account the various taskbar sizes in windows, you can have a double row taskbar or small taskbar icons

CatastrophicDInosaur | 2022-12-18 23:18