generalize keyboard listeners