Open devtools for each tab in the background

35 views
Skip to first unread message

patanaik...@gmail.com

unread,
Aug 26, 2024, 9:18:55 AMAug 26
to Chrome DevTools

I have a use case where I need Chrome’s DevTools to automatically open in an undocked state for each new tab or window, but without shifting focus away from the browser window.

To achieve this, I’m doing the following:

• Launching Chrome with the `--auto-open-devtools-for-tabs` cli argument.

• Modifying Chrome’s preferences to have `currentDockState = 'undocked'`.


However, when DevTools opens, it immediately steals focus, which disrupts my workflow.


Is there a way to keep DevTools undocked and automatically open in the background without shifting focus away from the main browser window? Or alternatively, is there a way to programmatically move the focus back to the browser window after DevTools opens?

guest271314

unread,
Aug 27, 2024, 12:47:02 AMAug 27
to Chrome DevTools
You can use an extension with chrome.windows.update(windowId, {focused:false}) called when the tab or window is created that can be observed with chrome.tabs.onUpdated.addListener(fn).
Reply all
Reply to author
Forward
0 new messages