One method that works really well is the following:
- Unplug your laptop's charger
- Disconnect from the internet
- Work using only using your battery charge and the documentation on your laptop
If you find that you need an information about something that's in a doc you don't have, only connect to the internet to download it, then disconnect. Nothing more.
Batteries will only last for about two hours when they're not new, and you have the docs on your machine without distractions online. This forces you to work only on what you're working on, and do it fast as the battery is discharging so you catch yourself more often "drifting" in your thoughts, and you'll get better at catching yourself and focusing again, because "Quick! It's discharging!"
I know it sounds silly as you can just connect to the internet or plug your charger, but it really works. Its real job is to remind you to focus and get things done.
Try it, and you'll find soon enough just how much of your attention was scattered, but you'll be weaning as soon.