cheeaun / max-tabs

A no-restart Firefox extension to set maximum number of opened tabs in a window.
https://addons.mozilla.org/en-US/firefox/addon/max-tabs/
8 stars 20 forks source link

open tab on next available window #16

Open robsonsobral opened 9 years ago

robsonsobral commented 9 years ago

Hi!

Thanks for the last update.


Sometimes, when we have more than one window open, firefox uses the last one focused to open links.

Is it possible to open the link on the other window, if this one is full?

Thanks!

robsonsobral commented 9 years ago

Ok! I gave up!

I tried, but, first, I couldn't find the URL being requested to send it to another window. Because of that, I had to wait for the ready event. Then, I couldn't find how to loop through windows and open the tab.

if (windows.browserWindows.length > 1){
    tab.on('ready', function(tab){
        for (var i = 0, w = windows.browserWindows.length; i < w; i++){
            if (browserWindows.activeWindow !== window[i] && window[i].tabs.length <= max){
                window[i].tabs.open(tab.url);
                break;
            }
        }
        tab.close();
        notifications.notify({
            title: title,
            text: _('not_open_max_tabs', max)
        });
    });
} else {

So, #15 is also beyond my capabilities.