I do basically the same thing. I use the pomodoro technique (https://en.wikipedia.org/wiki/Pomodoro_Technique) when I'm really struggling to focus. I either use an old school analog kitchen timer or https://pomofocus.io if I'm feeling real web 2.0-ish.
Some sort of self-imposed time constraint, whether basic time tracking or pomodoros, is one of the most effective ways I've found to just power through work I don't really want to do.
If _most_ of my work is hard to complete due to excessive distraction and lack of focus, that usually means something larger is wrong. That's when its time to reflect and figure out if I'm working on the wrong team or project or even company.