You could try recursion. Call the function SetPomodoro(task, time) from within a Pomodoro, if that is needed.
When you get to a point where you have to wait for a response (from the tests, or the compiler, or IRC) set a new timer and start a new sub-Pomodoro. 25 minutes might not be the appropriate time frame, but estimate how long you have to wait and set a timer for that long. Until this second timer goes off you can check emails or do “other stuff” and be confident you are spending your time wisely.
The idea is to minimize the time spent choosing what to do, or worrying about what you are doing. Decide, set the timer, get stuck in. Use your own judgement to determine what timeframes and levels of recusion are appropriate to your workflow.
My own posture improved once I took up singing. My theory is that I was focused on improving my vocal technique and that changes to my posture directly impacted on this. If I stood or held myself a certain way I could sing better, and the feedback I was getting on my singing ability propagated back and resulted in improved posture. Plus, singing was a lot of fun and with this connection pointed out to me—“your entire body is the instrument when singing, look after it”—my motivation to improve my posture was higher than ever.
That is more how I got there than conclusions. Hmm. You might consider trying to find something you value for which improved posture would be a necessary component. Or something you want to do that will provide feedback about changes in your posture.
If you are like me, “I don’t want to have bad posture anymore” may turn out to be insufficient motivation to get you there by itself.