Keyboard support

This is WIP and targets #263, #314