Is there a way i could detect maximized window(s) in Ubuntu (Gnome 3) and do that reliable? And if it is is there a way i could run a script that would do one thing when it would detect maximized window(s) and another when there would be no maximized window(s)?

Thanks!