brotab icon indicating copy to clipboard operation
brotab copied to clipboard

Windows/Chrome : Activate without --focused focus on a "random" window

Open naeloob opened this issue 5 years ago • 0 comments

In background.js :

  activate(tab_id, focused) {
    this._browser.tabs.update(tab_id, {'active': true});
    this._browser.tabs.get(tab_id, function(tab) {
      chrome.windows.update(tab.windowId, {focused: focused});
    });
  }

Better just call chrome.windows.update with {'focused': true} if --focused is set. Dont know why, but at least in windows, now put the focus in a "random" window even with --focused not set.

Regards

Edit : I think that the problem is that if you set the focused to false it returns the focus to the last focused window. So better to not send a focused false.

Edit2: From the documentation: https://developer.chrome.com/extensions/windows

(optional) focused : If true, brings the window to the front; cannot be combined with the state 'minimized'. If false, brings the next window in the z-order to the front; cannot be combined with the state 'fullscreen' or 'maximized'.

naeloob avatar Feb 21 '20 21:02 naeloob