Windows: Watch 4 Idle is a small app that allows you to issue commands or run applications on your desktop whenever the machine idles.
If you're savvy with Task Scheduler, you can accomplish something similar by setting an idle trigger. However, Wait 4 Idle is much simpler and more straightforward. You can set this app to power your machine down, lock it up, or run any executable or batch command. The application does attempt to install an unnecessary toolbar during installation, so be sure to read carefully and avoid installing anything you don't want.