Treat the rest as a dedicated, specifically-timed “thing to do” instead of just “time I need to kill until I pick this weight up again.”
Timers are helpful, as people mentioned, but stretching, evaluating how that last set went/ how next set needs to go, changing weights, and walking around to catch your breath are great ways to stay mostly on track.
And if you check Twitter after switching songs or something? That’s fine. Working out slowly > not working out, so unless you’re annoying other gymgoers with 20-min squat-rack scroll sessions , I wouldn’t sweat a mental lapse.
EDIT: Ope, I think I misread your comment to mean “between sets” and not just “going to the gym,” my b.
It HAS to be a habit. Go to the gym because it’s novel and you want to try it out, then try your damnedest to make it a routine. Make it feel weird to not work out. If you fall off the wagon, try again.
If neurotypicals fail to be consistent (see every New Year’s resolution), you can give yourself enough grace to stumble, too.
There are no friends in Mario Kart, only those I have yet to betray.