Add input thread on Linux, and fix idle and Ctrl+C behaviour (fix #451)