window selection detection implemented, not quite what I wanted