How do I do this?
When you open your talent tree, check bottom left, there is a tab call specialization
The whole tab flow in that window is a big half-baked, and really should offer a means to swap specs without swapping to that tab. I use a mod called “Talent Tree Tweaks” which (amongst others) allows you to swap without swapping tabs.
Macro to one button switch back and forth:
/run SetSpecialization(GetSpecialization()==2 and 1 or 2)
Enjoy