Smarter window behavior