I'd somehow missed that @Fokke had written this neat AppleScript solution and merrily went off down my own rabbit hole implementing this in a similar (if messier) way using Bartender menu bar automation. Still, I enjoyed the journey . The resultant macro is over here.