How to keep Firefox 3.5 running after closing last tab and add a close tab button on the last tab

Posted by Saad Ibrahim 2 July, 2009

Firefox 3.5 came with one one more annoying UI change that is once you have closed all the other tabs and only one tab is open the close tab button disappears from the tab and you can now just close the Firefox window by pressing the close button on top right or just hit ctrl+w but the problem is that this behaviour is not really suitable for a browser like Firefox which takes ages to start once you close it unlike Google chrome, and personally i am used to closing all the stuff in the tabs and let Firefox keep running and then open any website i have to in the empty tab. so now i am going to show you guys how to disable Firefox from closing the window when you close the last tab.

Type about:config in your Firefox address bar and press enter press the “I’ll be careful, I promise!” button and now search for “browser.tabs.closeWindowWithLastTab” and double click it to change its value to false, now whenever you close the last tab using ctrl+w or the close tab button we are just going to add the Firefox window wont close.

sshot-1

I personally like to have a close tab button on all the tabs in Firefox even if there is one tab open which was the default behaviour of Firefox 3.0 so that i can close the site opened in a tab and have an empty tab, so now to get that close tab button back you will have to modify the userChrome.css file for that we need to open the chrome folder where the userChrome.css file resides for that you need to browse to “x:\\Document and Setting\%your username%\application data\Mozilla\Firefox\profiles\%your active profile folder%\chrome\” (where x is your windows installation directory), once you are there, you have to find the userChrome.css file if its not there, don’t worry, its not there for most people just open userChrome-example.css file and save it as userChrome.css and now add these lines to it under the @namespace line:

/* Add tab-close-button to last tab*/

.tabbrowser-tabs[closebuttons="alltabs"] >

.tabbrowser-tab > .tab-close-button {

  display: -moz-box !important;

}

.tabbrowser-tabs:not([closebuttons="noclose"]):not([closebuttons="closeatend"]) >

.tabbrowser-tab[selected="true"] > .tab-close-button {

  display: -moz-box !important;

}

now just save the file and close it, restart Firefox and you will now see the close tab button appears even if you have one tab open, this along with the above tip can make using Firefox a bit more convenient.

 

sshot-3

if you encountered any problem just leave a comment and i will be glad to help you out.

If you enjoyed this post, make sure you subscribe to my RSS Feed
Share and Enjoy:
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Facebook
  • Technorati
  • E-mail this story to a friend!
  • Twitter
  • Yahoo! Buzz
Categories : Firefox Tags : , , , , ,

Comments
July 9, 2009

ooohhhh!!! achaa!!! :P

Posted by FarooqK
July 9, 2009

Heh :P sup?

Posted by Saad Ibrahim
July 20, 2009

whoa saad that is awesome. I also like close button on all tabs :D

nice tut

Posted by rival
August 1, 2009

Thanks a lot :)

Posted by philba
August 6, 2009

I think that’s impossible =)
thanks from Turkey !

Posted by erkan
August 11, 2009

Thank you very much for this awesome hack (in the best sense of the word). I have been poking around in the code, trying to solve a small issue, but I have been unsuccessful – I just haven’t had the time to really learn how to hack Firefox. I made one boring extension long ago, and never had the time to get back into it.

Anyway, when I right click on the last tab in a window, the ‘Close Tab’ context menu choice is greyed/ghosted out. I usually use the context menu and not the (x) button because my mousing skills have gone down hill due to carpal tunnel nerve damage. Even after getting the relevant surgery, my mouse aim is a bit too jittery for small buttons.

I wish I knew enough to solve this problem myself, but I don’t. Any help would be greatly appreciated.

Much obliged,

-Bif

Posted by Bif
Leave a comment

(required)

(required)