Retrieve command by keyup/keydown