Create a macro to detect newly created tab and focus (activate) on it

Hi, I have an extension that creates a pinned tab for its task. When it creates that tab this one is not on focus mode (active tab). This way, my work on another tab of the same window is not disturbed. However I'm in a situation where I want that tab to focus (activate) right once it's created.

I failed to find a chrome extension for that. Also I suspect I would need kind of script which is not a problem but where to start?

Thank you in advance for your assistance.