FF 58 - Auothide last tab

User Help for Mozilla Firefox
morat
Posts: 6432
Joined: February 3rd, 2009, 6:29 pm

Re: FF 58 - Auothide last tab

Post by morat »

@ejm_dc
morat wrote:The observer is not working in the userChrome.xml file. I don't know why.
I tested the following code snippet in the browser console in Fx 68 and Fx 69.

Code: Select all

(function () {
  function test() { alert("abracadabra"); }
  var observer = new MutationObserver(test);
  observer.observe(gBrowser.tabContainer, {childList: true});
})();
The alert opens when changing the tab count in Fx 68, but does nothing in Fx 69.
ejm_dc
Posts: 70
Joined: December 20th, 2003, 4:12 pm

Re: FF 58 - Auothide last tab

Post by ejm_dc »

@morat

Thank you. So, does that mean there is likely nothing that can be done to fix this?
morat
Posts: 6432
Joined: February 3rd, 2009, 6:29 pm

Re: FF 58 - Auothide last tab

Post by morat »

@ejm_dc

I don't know a solution offhand, but I didn't research the issue.
ejm_dc
Posts: 70
Joined: December 20th, 2003, 4:12 pm

Re: FF 58 - Auothide last tab

Post by ejm_dc »

Thanks, @morat.

Please do let me know if anything comes to mind. I was able to remove the last tab using this simple css:

#tabbrowser-tabs tab:first-of-type:last-of-type { display: none !important; }

But it leaves the large gray bar in tact, so it's less than ideal.
ejm_dc
Posts: 70
Joined: December 20th, 2003, 4:12 pm

Re: FF 58 - Auothide last tab

Post by ejm_dc »

In case anyone is looking for a solution, I was able to get help here: https://www.reddit.com/r/FirefoxCSS/com ... n_in_ff69/

This works very well with FF69 so far:

https://github.com/MrOtherGuy/firefox-c ... ntrols.css

And, if you want tabs on the bottom, these two work (the last one if you use the menubar):

https://github.com/MrOtherGuy/firefox-c ... bottom.css
https://github.com/MrOtherGuy/firefox-c ... _patch.css

Thanks for all the help here!
morat
Posts: 6432
Joined: February 3rd, 2009, 6:29 pm

Re: FF 58 - Auothide last tab

Post by morat »

Try this:

* userChrome.xml

Code: Select all

<?xml version="1.0"?>
<!-- autohide last tab -->
<bindings xmlns="http://www.mozilla.org/xbl">
  <binding id="execute_javascript_code">
    <implementation>
      <constructor><![CDATA[
        (function () {
          if (window.ucjsExecuted) return;
          window.ucjsExecuted = true;
          var navToolbox = document.getElementById("navigator-toolbox");
          var menubar = document.getElementById("toolbar-menubar");
          var tabbar = document.getElementById("TabsToolbar");
          navToolbox.insertBefore(menubar, navToolbox.firstChild);
          function showHideTabbar() {
            tabbar.style.visibility = (gBrowser.visibleTabs.length == 1) ? "collapse" : "";
          }
          showHideTabbar();
          function tabOpened() { showHideTabbar(); }
          function tabMoved() { showHideTabbar(); }
          function tabClosed() { showHideTabbar(); }
          gBrowser.tabContainer.addEventListener("TabOpen", tabOpened, false);
          gBrowser.tabContainer.addEventListener("TabMove", tabMoved, false);
          gBrowser.tabContainer.addEventListener("TabClose", tabClosed, false);
        })();
      ]]></constructor>
    </implementation>
  </binding>
</bindings>
I don't understand the reason for the following line.

Code: Select all

navToolbox.insertBefore(menubar, navToolbox.firstChild);
Maybe it works with a CustomCSSforFX tweak?

Notification when a tab is added or removed
http://developer.mozilla.org/docs/Archi ... or_removed
ejm_dc
Posts: 70
Joined: December 20th, 2003, 4:12 pm

Re: FF 58 - Auothide last tab

Post by ejm_dc »

Thanks! I'll give it a try. Not sure about the code lines. I took that from this thread. It worked well for a while, at least until FF69.

Thanks again for all your help!
GKnight
Posts: 24
Joined: November 7th, 2013, 8:51 am

Re: FF 58 - Auothide last tab

Post by GKnight »

Resurrecting this old thread.... I had a great success hiding single tab on my Linux box with originally code from abortix, and then morat's fixes for FF 68. It was finally time to update to FF 80, and no surprise, this no longer works. Any hope of hiding single tab on FF80?
User avatar
DanRaisch
Moderator
Posts: 127240
Joined: September 23rd, 2004, 8:57 pm
Location: Somewhere on the right coast

Re: FF 58 - Auothide last tab

Post by DanRaisch »

Thanks for your input but this thread has been dead for a year. I think it's time we let it rest in peace.
Locked