Automatic keyboard detection

[endlessm/eos-shell#3425]
`istream` is leaked