I work a desk job too. Actually one of my biggest diet struggles is here... there's a lady who keeps a bowl stocked with some of my favorite candy and she is at a major "intersection" in the office
But when it's crunch time I account for that. That candy is pretty much my only vice, and I think I can change my route to avoid her completely. Sometimes you just have to be honest with yourself to set yourself up for success. If you can't chill with the snacks and they are interfering with your goal, find a way to cut them out as much as possible

Like I said when it's crunch time I lock in. So aside from that candy and refeed days I have pretty much 95% adherence. But I have meal plans that I follow and don't even have to think about.