Controlling sleep mode through input

There is another thread happening simultaneously that might be helpful: