The first thing I would check is for vacuum leaks on the engine. Extra air into the engine changes the air / fuel ratio. As a result, you get a rough idle. It isn't noticeable when driving because there is already a lot of air entering the engine. The small amount doesn't make too much of a difference then.