Limiting the time I spend online has a net positive impact on my productivity. When I notice I'm out of focus, stepping away from my computer to cook, write, read, exercise, or socialize is the smartest way I found to get something done while giving myself a break.
Writing is relaxing, and so does a quick chat by the water dispenser or a quick read in your favorite armchair.
We could call this intermittent digital fasting, where instead of eating during an eight-hour window you're only allowed to interact with a screen for five hours top, two hours after waking up.
I hit my peak energy level around two hours after waking up, and my will power gradually decreases throughout the day. Studies also observed the negative effects of using electronic devices at night. If you're like me, we could benefit from aligning our computer usage with the position of the sun.
Easier said than done. A little planning can give us the push we need to go through with it. Making a list of things we can do offline helps. I wrote mine a few weeks ago and I've been quite consistent with it as a result. Having the right environment helped as well, but it can't be used as an excuse for poor self-control: developing the right habits is key and should prevail over one's environmental settings.
Learning to use a tool efficiently implies to understand when to avoid it: fasting is a purifying constraint.