Help: Widget for Window State

Hey guys,

how can i build a widget for my max! window sensor? I don’t find a tutorial for this.