handle key events only when running