Generalized friction forces in electrochemical and gravitational non-equilibrium systems with or without temperature gradients