Identify all the elements that sap your attention and either have a way to prepare beforehand or a strategy to avoid them.
Example: I make sure to choose music beforehand so I don't have to choose something adhoc, and put my phone away to minimise social media distractions.