We study weighted versions of Dirichlet's theorem on the probability that two integers, taken at random, are relatively prime. This leads to a uniform approach in the study of several counting problems in discrete and computational geometry relating to incidences between points and lines.