fix #3 handle split layouts and multiple windows more consistently