Tuesday, November 4, 2008

Shortcut to Toggle Firefox Bookmarks Toolbar (like Chrome)

One of the things I've really liked about Google Chrome is the ability to toggle the bookmarks toolbar with a quick Ctrl+B. I hunted around for this ability in Firefox but it took a little finagling -- here's the how-to:

  • Install Keyconfig.

  • Open Keyconfig's configuration dialog via "Tools | Keyconfig..." or Ctrl+Shift+F12.

  • If you want to use Ctrl+B to toggle the Bookmarks Toolbar, first disable the default association to "Bookmarks" by selecting it and clicking the "Disable" button.

  • Click the "Add a new key" button and fill out the form using the following:

    • Name:   Toggle Bookmarks Toolbar

    • Code:
      var b = document.getElementById('PersonalToolbar');
      b.collapsed = !b.collapsed;


  • Click "OK."

  • Select your new key, select the text field, type your desired shortcut (Ctrl+B, for example), and click "Apply."

Your shortcut will be active in the next window opened. Yay nerdiness!

Another key I've added is a shortcut to toggle the status bar. Here's the code:
var s = document.getElementById('status-bar');
s.hidden = !s.hidden;
Enjoy!

21 comments:

  1. Nice! A toolbar button that could toggle the bookmarks bar on/off would be even nicer...

    ReplyDelete
  2. Thank you!

    ReplyDelete
  3. Nice, thanks a lot! This should rreally be in there by default.

    ReplyDelete
  4. Thanks for the little tweak!

    ReplyDelete
  5. Excellent shortcut. Thanks!

    ReplyDelete
  6. wow, pretty nifty and the best part is, it works like a charm, thanks a lot Vic :D

    ReplyDelete
  7. Absolutely great! Thanks so much for sharing your nerdiness!!

    ReplyDelete
  8. If you install the Custom Buttons add-on, you can put the same code in a new button and it will create a button to toggle it!

    ReplyDelete
  9. Thanks for the great post, i continue to learn from your advice!

    ReplyDelete
  10. Hi -- with Firefox 4, this now has a bug:

    On initially launching the program, this only makes a blank toolbar appear and disappear at first.

    Workaround: You have to manually make the toolbar appear through Firefox's own menus, and then the code above works. But you have to do this every time you close and re-open firefox.

    Could you post a way to fix this? It would be SO useful!

    Thanks!!

    ReplyDelete
  11. Hi - me again - I also notice that with your method, the "bookmarks" drop-down button behaves differently.

    This is the "bookmarks" drop-down button in the default toolbar set for Firefox 4.

    Normal behavior re: bookmarks toolbar:
    - Click this button, select "View Bookmarks Toolbar"
    - Toolbar appears, button DISAPPEARS, now located on the bookmarks toolbar.
    - Click button, deselect "View Bookmarks Toolbar", toolbar disappears, and button reappears on the ordinary toolbar, where it was before.

    Behavior with the CTRL+B code above:
    - Click bookmarks drop-down, select "view bookmarks toolbar", bookmarks drop-down goes away from main bar.
    - CTRL+B, toolbar goes away, but bookmarks drop-down button doesn't reappear.


    This is in addition to the problem noted yesterday.

    I figure the problems are actually related, so thought this tidbit might help you figure it out.

    Thank you again, and hope this helps! Even with the bugs, I find myself using your code because it's just so useful ... hopefully we can get it to work as it should!

    ReplyDelete
  12. @eblable - Thanks for your effort!

    I've checked out this issue, and the weird thing is that it works okay for me. I'm running it on Windows XP as well as Mac OS X.

    What I have noticed is that there are possible toolbar configurations which the Firefox 4 upgrade path does not seem to handle correctly. My guess is that your experience is a case of this.

    With my configuration, I used to have the "new tab" button on the toolbar. That somehow prevented the small new-tab "plus" from being shown to the right of the last tab in Firefox 4. I think I managed to get it back by removing the new tab button from the toolbar while in "Customize..." mode, or maybe by choosing "Restore Default Set."

    A couple of things you can try:

    * Remove the Bookmarks button and/or drop-down while in "Customize..." mode, then re-add it/them

    * "Restore Default Set" while in "Customize..." mode

    * Disable your key configuration in key config, restart Firefox, then reassign your hot-key

    * Uninstall and reinstall Keyconfig

    * Create a new Firefox profile (see here), install Keyconfig and see if it works

    All of these amount to "turning it off and on again," but maybe one of them will do the trick. Good luck.

    ReplyDelete
  13. @eblabla I am facing the same problem. I am not sure whether you are gonna see this. But, do tell me the solution for the "blank icons". Thanks a lot!

    ReplyDelete
  14. Can you please post the solution here? I am here because of Google. It might benefit others as well. Thanks again. Thanks Vic too!

    ReplyDelete
  15. is this application available for firefox 4? if yes how can i install that? Thanks.

    ReplyDelete
  16. I was referring to keyconfig..

    ReplyDelete
  17. I found it..!! This is cool.. Thanks.

    ReplyDelete
  18. solution for blank toolbar
    var bar = document.getElementById("PersonalToolbar");
    setToolbarVisibility(bar, bar.collapsed);

    source:http://forums.mozillazine.org/viewtopic.php?f=48&t=72994&start=1860

    ReplyDelete
  19. Just switched back to FF today. Thanks very much!

    ReplyDelete
  20. Thank you very much, it works also on seamonkey!

    the name of the address bar is: nav-bar

    ReplyDelete
  21. Thank for your guide. I am using Firefox not very often because of these thing. Chrome UI is much better and comfortable. But few time ago i installed ask.com toolbar (it was mistake) and my Chrome start lagging. I found removal guide http://removalbits.com/how-to-remove-ask-com-and-search-ask-com-from-your-computer-removal-tutorial/ and now all works fine, but i already switch to Firefox in these two weeks.

    ReplyDelete