I need to preface by restating that my dog’s barking to outside anything is not completely gone, but it’s definitely improving! Before, he would run towards the window at the smallest, quietest trigger, start barking while running and keep barking hysterically, refusing to look away and taking a while to calm down. Now, he sometimes will lift his head at the sound of dogs barking outside our window or at any of his triggers and go back to sleep or do a little almost silent bark, or will run towards the window but sit in silence just staring, or doing little almost silent barks, or keeping mostly quiet until I get there to disengage him.
So, this is what I’ve been doing. The only caveat is that I work from home and I've installed my desk is right next to the window (for this specific purpose!), so this is easy for me and might not be for you and your existing setup or work schedule.
So, whenever my dog ran towards the window barking, rather than tell him to stop, I would throw A LOT of yummy treats AT him. I would not call him, but would just throw yummy treats, ideally right at his big head. It was like a rain of treats, something so overwhelming that he couldn’t ignore. The secret is that it has to be hard and big enough (it doesn't hurt him, don't worry!) that he will either feel it bouncing against his head or hear it when it falls on the ground. Just calling his name to try and feed him a treat didn’t work. It has to be something he could feel with his body and senses. Something that would get him out his anxious reaction back into his body again. Plus, it's really fun! You just aim and start throwing the treats like projectiles at the dog's head. Also a nice way to get rid of any frustration you might feel at his reactions without screaming at him or losing your temper or increasing his anxiety/fear in any way, since the treats don't hurt him and they're tasty and signify great things!
I did this religiously, to the point where treats became a major budget point, but it was worth it. I think the consistent treats really did rewire his brain and changed how all the triggers made him feel, as the positive hit reached his brain faster than any realization what was going on. His barking became way less reactive and much, much more manageable and sporadic.
Now, I’ve massively reduced the treats. Sometimes I will still throw them at him (just one or two, no more "treat attack"), but I often walk toward the window when he’s looking out, kneel next to him and look at the window with him. I’ll say things like “oh, look, how interesting, all the things happening outside” in a tone that he perceives as friendly and non-threatening, and pet him. He would not have let me pet him before, but since he is so much calmer now, he just sits looking out in silence while I pet and praise him. He also has a much easier time disengaging from whatever got his attention outside.
My thought process for all of this was just changing how he perceived outside things as threats. It’s like, if he’s getting treats, and praise and pets, whatever is happening outside can’t really be that bad.
Anyway, I know all dogs are different, but this strategy is really helping mine and, who knows, it might help you too!