balta2ar / brotab

Control your browser's tabs from the command line
MIT License
389 stars 27 forks source link

Does brotab know which window has focus? #67

Open bjohas opened 2 years ago

bjohas commented 2 years ago

Related to https://github.com/balta2ar/brotab/issues/65, does brotab know which window has focus? Or does brotab only know which tab (within a window) is active?

bjohas commented 2 years ago

If I'm interpreting this correctly https://stackoverflow.com/questions/8451189/chrome-windows-getcurrent-is-not-returning-the-list-of-opened-tabs, then it looks like chrome.windows.getCurrent would get the window:

chrome.windows.getCurrent(function(win)
{
    chrome.tabs.getAllInWindow(win.id, function(tabs)
    {
        // Should output an array of tab objects to your dev console.
        console.debug(tabs);
    });
});

It wonder whether it may be possible to implement that? I.e., brotab active would get the active tab in each window, but brotab activewindow would get the active window.

bjohas commented 2 years ago

Just to add that, as far as I can see, this function would just be:

bt query +currentWindow

I.e., the command already exists.