Measure horizontally over the top of the window, where the casing meets the wall, from one upper corner to the one across from it.
Transfer the measurement to a piece of trim, with two marks along the bottom edge and the measured span between them.
Lay the trim on the miter saw platform, so the front faces up and the bottom faces the blade. Line up one of the two marks with the blade. Turn the blade so it points 45 degrees outward. Make the cut.
Move the trim to put the second mark under the blade. Turn the blade to 45 degrees in the opposite direction, so it again points away from the main span of the trim. Make the cut.
Set the trim against the wall above the window, so the bottom edge is lined up with the upper edge of the window. The mitered ends should rise up off the two upper corners. Use your trim nailer to drive nails every 10 t0 12 inches along the upper and lower edges of the trim.
Repeat the process for each edge of the window. Install the trim so the mitered ends butt to one another at the corners.
Run beads of caulk around the trim where it meets the wall and the window casing.