Clean the lines around the window trim thoroughly, on both sides (where it meets the wall along the outer edge, and where it meets the window casing around the inner edge), using a cotton cloth and rubbing alcohol. Make sure there to is no dust or loose material left there.
Set your caulk tube in the caulk gun. Cut a 1/4-inch diagonal hole at the pointed end of the tube with your utility knife. Push a long framing nail into the hole to open the seal and release the caulk.
Set the cut tip at one end of the trim around one side of the window, where it meets the wall. Compress the trigger of the gun until caulk comes out the tip.
Pull the gun backward along the joint, laying a straight, smooth line of caulk over the whole span. At the end, lift the gun off the joint and immediately press the release latch at the end of the gun to stop the caulk flow.
Wet your thumb and press it lightly all along the length of the caulk line to smooth and flatten it.
Repeat the process for the lines around the outer and inner perimeter of the trim, where it meets the wall and the window casing.