> Toolstrips are not per-tab, they are per-window. So there is no such thing
> as getting the tab id of the tab that a toolstrip is attached to.


Doh! I knew this two weeks ago, but had apparently forgotten.

> You can get the tab id of the selected tab in the current window (that is,
> the window that the toolstrip is running in), like this:
>
> chrome.tabs.getSelected(null, function(tab) {
>   console.log(tab.id);
>
> });

So I rewrote it to use

chrome.windows.getCurrent(function(thisWin){
    chrome.windows.getLastFocused(function(focusedWin){
      if (thisWin.id === focusedWin.id){
        console.log("current toolstrip is on the focused window");
      }
    });
  });

and then I realised that the window object has a focused attribute

chrome.windows.getCurrent(function(thisWin){
    if (thisWin.focused){
      console.log("current toolstrip is on the focused window");
    };
  });

and things are much simpler now. thanks Aaron.




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Chromium-extensions" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/chromium-extensions?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to