Regarding the answer to my previous question of Android's idle Wi-Fi use, it seems like a huge waste of battery life to have Wi-Fi constantly scanning and draining battery. So it seems it would be better to turn Wi-Fi off.
However, I'd still want my Android to connect automatically to my home network, for podcast sync and other large transfers. This woudn't need to be immediate, since I usually spend a long time at home.
I do know there are apps that give me a Wi-Fi toggle widget, but I don't want to be constantly switching Wi-Fi on and off manually. I know it's only a minor bother, but it just seems silly to have to do that since it would be pretty easy to have logic that does it for me.
Question: Are there any applications that would periodically (say, once ever 15 mins) turn Wi-Fi on just to do a quick network discovery, then in case a known Wi-Fi is found keep it on as long as I am in range?
Further: Any pointers as to how hard such an app would be to write? For example in GNU/linux it would probably be easy to do with just a very simple shell script running on background - does Android work like that too, or is it a much harder task?
(I expect this would in any case require rooting the system, but that's understandable and not a problem.)