Everyone's writing habits are different of course, but I dare say I'm not alone in having trouble sitting before a keyboard and a blank screen and summoning the energy to type for extended periods without casting frustrated eyes over the word-count feature or hearing the calls of YouTube or some equivalent like Sirens beckoning Homer.
But that won't do, will it? We need to be writing and making progress consistently and finishing books, stories, articles and the like so we can reveal them to the world and have the world acknowledge our magnificence in turn and pay tribute in cartloads of gold and rubies.
So what to do? Well for my part I place myself in a situation where I have nothing more enjoyable to do than writing and for that, I find the wretched daily commute to and from my embarrassing job works wonders.
When your alternatives are to stare out the window at a sight you've seen a thousand times before or ponder the possible reasons as to why the fellow sat next to you smells of fish-oil, the work involved in writing becomes far more tolerable. I've written all three of my published books (PLUG: https://www.rmepaul.com/works-available-to-buy) in notepads on bus trips and then transcribed them at home. If not for this approach, my output would be a fraction of what it is.
Obviously, that's not an option for everyone but I dare say the general idea can serve you well; find some way to turn the most tedious thing in your day to your advantage and, if it please you, create a pocket of isolation and inactivity around you to work in and results may well follow.
As a demonstration (of sorts) allow me to link you to the first proper work I wrote on the bus. A completely free downloadable narrative poem hight 'Nellack and Caleara'; a fairy tale involving two young runaways whom destiny contrives to have meet in the haunted Wolf's Wood.
Alternatively here's a YouTube version narrated by myself: