There's a limit to how much you can focus. So avoiding distractions and the like helps, but there's going to be a personal limit you can't get pass - 30 minutes or 2 hours or whatever. And it's impossible to get rid of all distractions.<p>What to do, then?<p>1. Make sure you're strongly motivated. If you have strong motivation you'll get back to work soon after the distraction, instead of going down the rabbit hole of wikipedia articles or whatever.<p>2. Write everything down: what you're doing next, where you are, etc.. That way when you get distracted and then get back to work, you'll have an easier time getting back to work immediately: just read your notes.<p>Longer version here: <a href="https://codewithoutrules.com/2017/08/03/stay-focused/" rel="nofollow">https://codewithoutrules.com/2017/08/03/stay-focused/</a>
I use my desk only for work - no eating or lounging on the internet - that's what my mobile device is for. I then have a playlist of ambient music. This also cues my brain that I'm in work mode.