scale to window size, by emolch (Thanks!)