I believe the game does that automatically since x.xx patch (which I don't remember but it's been a while) if you're using the default Blizzard actionbars or an actionbar addon that's re-using them.
That's as far as primary / secondary spec go.
Now if we're talking re-specs maybe something like
SimpleActionSets or
ActionSwap 2?