Tape off the glass to protect it from the paint. But taping takes time and you run the risk of peeling some of the paint off with the tape.
Paint on a protective film on the glass and then peel it off after you have finished painting. Again you have the time invested into painting on the protective film.
OR paint as neatly as possible and then use a razor blade to scrape off any excess paint. This method just takes time and finger cramping to complete.
The third method is usually my method of choice but when I look at all the window sashes, storm windows, and doors that need to be painted the thought of any scraping with a razor blade makes my fingers hurt in anticipation.
A while back I ran across a paint brush on eBay from a seller in the UK that I think might help eliminate a lot of my scraping.
I haven't tried out the brush with paint yet but when I did a dry run, it felt like I would be able t control the flow of paint nicely. There is also a nice point in the center of the bristles that should make getting the paint in the corners a lot easier.
The brush also felt nice to hold. I have a few brushes that for the life of me just do not feel right. I'm not sure if it is the shape of the handle, how the bristles are angled or not angled, or how it is weighted. I wish I knew what it was so I could stay away from those brushes.