Monday, June 21, 2010

Presenting.........Close Multiple Tabs!

Here goes another..... after, well, a fair bit of struggle around the tricky parts. This add-on was mostly easy, after understanding how dialogs work, but I struggled for some time trying to update the dialog as changes were made in the browser window while the dialog was still open. I had considered restructuring the entire thing, but I realized soon enough that it wasn't such a great idea. Then it happened, almost by mistake. I tried to open the dialog again while it was still open, and magically, the contents of the dialog got updated! I then realized that the trick was to reload the dialog whenever a change was made with the tabs in the main window, and with that I was able to finish the add-on and submit it. I'll discuss the implementation in a later post.

Here's the description I've given on the Mozilla Add-Ons Site:

I'm pretty frequently faced with a situation where I have 20 or more tabs open, and I wish to close all but 3 or 4 of them.It's a pain closing them all one by one, while being careful about not closing the ones I need. So, I built an Add-on to solve this problem.

This add-on allows you to close many tabs with a single click. Select File->Close Multiple Tabs, or just press Ctrl+Q to open a dialog showing the list of tabs that are currently open. You can select the tabs you wish to close from the list, and click OK (or just hit Enter!) to close them. If all the tabs are selected, then you have the option of choosing between a blank page and the browser's homepage.This way you can get rid of all the tabs and start a new session, without having to, perhaps, restart the browser.

Tip: Use Select All and deselect the tabs you need when you wish to get rid of all but a few tabs (like 3 or 4 out of 20), and use Select None and select the tabs you wish to close if they are few in number. This way, you'll find this add-on really handy.

You don't have to worry about cluttering of tabs anymore, because the solution is just one click away.
Happy Surfing!

Developer Comments

I realize that Ctrl+Q is perhaps, too important a shortcut to assign to this add-on, but this has been done only to make the add-on easily accessible, because those who actually find this add-on useful will find themselves using it quite often (at least that's the case with me), and fumbling repeatedly with a Ctrl+Shift+Something combination can be quite annoying.

7 comments:

  1. If an add-on called fox-tab is already installed then ctrl+q doesn't open the dialog.

    ReplyDelete
  2. Oh, I should've guessed that. I realized that Ctrl+Q is an important keyboard shortcut, and some popular add-on must be using it already. Maybe I can provide an option to set the shortcut to something convenient to the user in later versions.

    ReplyDelete
  3. keyconfig is an addon which can reassign keys. maybe you should recommend its use along with your addon. anyway keyconfig (which needs update for a long time but works without glitch) is a must-have addon for anyone.

    ReplyDelete
  4. Thanks a ton! You've drastically simplified my job.

    ReplyDelete
  5. hi Aakash,

    as of now the addon takes a lot of time to close each tab. if one uses the function "close all other tabs" from tab menu (maybe Tab Mix Plus is essential), it is very fast but the current tab is left open.

    maybe you could look into their code to figure out how to make your addon quicker.

    thanks

    ReplyDelete
  6. Yes, Tab Mix Plus is essential to do that. But you are right, I could add a button to close all tabs except the current tab, and do that quickly as well. I chose to close selected tab one by one, because it looked good, but I guess I should try closing them faster. Thanks!

    ReplyDelete
  7. please allow me to suggest a refinement of the button idea.

    it would be better if the button acts among the following two choices (set from options).

    1. close all tabs at once.
    2. close all but the current tab.

    Thanks.

    ReplyDelete