Prevent Chrome window to take focus over another Chrome window

169 views
Skip to first unread message

Noel Álvarez

unread,
Mar 5, 2023, 9:37:40 AM3/5/23
to Chromium Extensions
Good day to everyone.

I have two Chrome windows, which are related to two different profiles.

I'm in need of open new tabs programmatically, because i'm doing performance test to my application that can't be fulfilled just with get queries, so i need to open tabs.

When my test is running, i'm not able to use my other profile Chrome window, because act of open new tabs capture focus and interrupt my daily tasks on my main profile.

I was created an extension that uses chrome.tabs API to prevent focus, and it's working just in same window, i could open tabs without getting focus captured by new tabs. But talking about window layer, this Chrome window takes focus every tab is opened.

Story is different when i'm using a w10 application like VSCode. In that case, Chrome window is not able to capture focus and i can write code with no distractions.

I'm reading about chrome.runtime and chrome.window but i can't get something that could help me.

I was tried chrome.window.onFocusChanged to capture when window is focused, and setted focus to false i chrome.window.update. And it helps a bit, because after focus event, focus is restored to my focused window. But between this time, window get focus for half o a seconds and make writting a bit difficult

Is it possible to control Chrome windows focus?

Thank you so much.
Reply all
Reply to author
Forward
0 new messages