How to change window size from script?

I’m trying to set my window to full screen/maximised mode
enter image description here

How do I achieve this via script?

I tried this answer but it’s obviously for windows operating system
whereas I’m using Ubuntu 22.04.1 LTS

TL;TR

If you’re asking how to minimize/maximize your Blender window, that is an OS terminal thing, although you can use 3rd-party Python libraries that mimics/passes on terminal commands by having Blender run them. Here’s the available Blender methods.

Toggle - Blender - Fullscreen

Code Snippet

bpy.ops.wm.window_fullscreen_toggle()

Screenshot

image

Toggle - Editor - Maximize Area

Code Snippet

bpy.ops.screen.screen_full_area()

Screenshot

image

Toggle - Editor - Fullscreen Area

Code Snippet

bpy.ops.screen.screen_full_area(use_hide_panels=True)

Screenshot

image

1 Like

I guess bpy.ops.wm.window_fullscreen_toggle() works,
but could you still name some 3rd-party Python libraries that I can look into?

Also, window_fullscreen_toggle() toggles between fullscreen mode whereas I always want to set it to window fullscreen, meaning if someone is in fullscreen they should stay in fullscreen

While I could name a few for Windows, I don’t have access to a Linux computer at the moment, so I wouldn’t be able to test which libraries would actually work in Blender: I don’t want to suggest incompatible, faulty or outdated libraries. Libraries that both work for Windows and Linux also don’t always work the same, terminal wise, because they use different terminal languages - some may argue otherwise.

To my knowledge, Blender doesn’t have a native method to check whether the window is in fullscreen or not. I think you’d need to use a 3rd-party libraries, as mentioned.