The physics
Each ball feels three forces. Its weight pulls down. The thread pulls along the thread. The other ball pushes it away.
At rest the three forces balance: T cos θ = mg and T sin θ = F.
tan θ = F / mg
F = k q² / r² r = 2ℓ sin θ
For small angles, x³ = 2k q² ℓ / mg. So the gap x grows as q2/3.
Unequal masses on one hook: m₁ sin θ₁ = m₂ sin θ₂.
In a liquid the weight becomes mg(1 − σ/ρ). The push becomes F / K.