With bpy I can call the following function:


But how can I track the state of the toggle so that I avoid unnecessary calls to the bpy.ops.wm.window_fullscreen_toggle() function?


3 Answers 3


You can use the code

size = bpy.context.window.y
if size == 0:
     # it's fullscreen
     # it's not fullscreen

I don't know if that's the proper way to do it, but it works for me

  • 2
    $\begingroup$ Will depend on screen setup. My desktop has only a title bar across the top with a height of 64. In full screen window y reports as -64 and in max (but not full) as 64. It's been my experience that blenders window.y is dodgy on ubuntu. On toggling out of full screen it sometimes reports as 250 instead. Found this out trying to overlay a decoration free window over a particular area type. (Text editor). $\endgroup$
    – batFINGER
    Dec 26, 2020 at 16:54

Third party window manager.

This may have changed AFAIK there is no property exposed akin to Window.is_full_screen in blender. Have resorted to using a third party window manager.

Get Monitor Resolution in Python

Example run on old monitor where 1200 x 1024 is full screen resolution.

Can get blenders context window height and width via

>>> C.window.height

or loop over all windows in C.window_manager.windows

I'm on ubuntu and have the lightweight ewmh window manager module available. The Gtk gi is another I often use for managing windows (focusing, moving workspace, making thumbnails etc)

Running from blender the current window is the active window.

>>> from ewmh import EWMH
>>> wm = EWMH()
>>> win = wm.getActiveWindow()
>>> win.get_wm_class()
('Blender', 'Blender')

Check its geometry

>>> win.get_geometry()
<<class 'Xlib.protocol.request.GetGeometry'> serial = 15, data = {'depth': 24, 'sequence_number': 15, 'root': <<class 'Xlib.display.Window'> 0x0000028e>, 'x': 0, 'y': 0, 'width': 1280, 'height': 1024, 'border_width': 0}, error = None>

Or query its states

>>> wm.getWmState(win, True)

Ok looks like in full screen, run the op

>>> bpy.ops.wm.window_fullscreen_toggle()

>>> wm.getWmState(win, True)

Probably worth mentioning, since I am using a window manager can do away with using the operator.

>>> wm.setWmState(
setWmState(self, win, action, state, state2=0)
Set/unset one or two state(s) for the given window (property
:param win: the window object
:param action: 0 to remove, 1 to add or 2 to toggle state(s)
:param state: a state
:type state: int or str (see :attr:`NET_WM_STATES`)
:param state2: a state or 0
:type state2: int or str (see :attr:`NET_WM_STATES`)

So to set full screen using ewmh

>>> wm.setWmState(win, 1, '_NET_WM_STATE_FULLSCREEN')
>>> wm.display.flush()
  • $\begingroup$ Thanks for the help. Too bad the blender doesn't have a built-in property $\endgroup$
    – Empty
    Dec 26, 2020 at 17:29

For ubuntu users:

import bpy
import subprocess

monitor_width,monitor_height = subprocess.Popen('xrandr | grep "\*" | cut -d" " -f4',shell=True, stdout=subprocess.PIPE).communicate()[0].split(b'x')

if(int(monitor_width)==bpy.context.window.width and int(monitor_height)==bpy.context.window.height):
    print("not fullscreen")



You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .