How to track the state of a window toggle with python?
You can use the code
size = bpy.context.window.y
if size == 0:
     # it's fullscreen
else:
     # it's not fullscreen

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