We obtain the exact solution of the bond-percolation thresholds with inhomogeneous probabilities on the square lattice. Our method is based on the duality analysis with real-space renormalization, which is a profound technique invented in the spin-glass theory. Our formulation is a more straightforward way than that of a very recent study on the same problem [R. M. Ziff, J. Phys. A: Math. Theor.1751-811310.1088/1751-8113/45/49/494005 45, 494005 (2012)]. The resultant generic formulas from our derivation can give several estimations for the bond-percolation thresholds on other lattices rather than the square lattice.