MozillaZine

Remove Tab When Viewing Only One Page

User Help for Mozilla Firefox
rusty09

User avatar
 
Posts: 55
Joined: January 10th, 2009, 4:44 pm

Post Posted November 15th, 2017, 11:55 pm

There used to be an addon for this, but since the newest FF release, the addon no longer works. So, does anyone know how to remove the tab when viewing a single web page?

The tab takes up valuable page space, and is not necessary when only one web page is open.

Brummelchen
 
Posts: 2732
Joined: March 19th, 2005, 10:51 am

Post Posted November 16th, 2017, 8:24 am

not possible for now - and not for v59.

rusty09

User avatar
 
Posts: 55
Joined: January 10th, 2009, 4:44 pm

Post Posted November 16th, 2017, 10:18 am

Any chance that Mozilla will consider this?

In addition, the newer FF does not support toolbars, such as Roboform, either.

Richard1296
 
Posts: 42
Joined: July 29th, 2012, 2:25 pm

Post Posted November 16th, 2017, 12:25 pm

Well, actually it can be hidden with the following addition to userchrome.css

#TabsToolbar { visibility: collapse; }

But....you cannot open in a new tab or switch between tabs after the change,
except for using the down arrow in the url bar to switch from one tab to another,
however I have not found a way to close a tab without closing FF.
Everything must be opened in a NEW WINDOW.

It gets rid of the ugly dead wasted space, but at a price.

Richard

Gingerbread Man

User avatar
 
Posts: 7636
Joined: January 30th, 2007, 10:55 am

Post Posted November 17th, 2017, 3:11 am

rusty09 wrote:So, does anyone know how to remove the tab when viewing a single web page?

Well, sort of. If you have the title bar displayed, then I have it working reasonably well with a tab counter add-on and userChrome.css.
The problem crops up when you have the title bar hidden (default setting): the window controls plop down onto navigation toolbar, obscuring the buttons there. I could scooch the buttons over to the left to make room for the window controls, but then you have a blank space permanently there when you have more than one tab open. I see no way to address that.
You could try asking the authors of these add-ons to add the tab count as an attribute to #main-window (Tab Tally, Tab Counter, Tab counter, Yet Another Tab Counter). I don't know if that's actually possible in a webextension, but it would solve the issue if it is. Otherwise, we'd need the subject selector (bug 418039), and that's likely still years away.

Anyway, if you want to try this:
  1. Yet Another Tab Counter.
  2. Right-click the right side of the navigation toolbar, then choose Customize. Drag the Yet Another Tab Counter icon over to the left, so that it precedes the first tab.
  3. Add the following to your userChrome.css and remember to restart Firefox.
    Code: Select all
    /* Author: Gingerbread Man
    Hide the tab bar when only one tab is open. Requires an add-on
    like Yet Another Tab Counter and the title bar being enabled. */
    #main-window:not([customizing="true"]) toolbarbutton[label="Yet Another Tab Counter"][badge="1"] + #tabbrowser-tabs,
    #main-window:not([customizing="true"]) toolbarbutton[label="Yet Another Tab Counter"][badge="0"] + #tabbrowser-tabs,
    #main-window:not([customizing="true"]) toolbarbutton[label="Yet Another Tab Counter"] {
      visibility: collapse !important;
    }
rusty09 wrote:Any chance that Mozilla will consider this?

I'm inclined to say no, because it was a feature at one point and now it's gone. Then again, this latest version moved the Reload button back the way it was ages ago, so who knows?
Last edited by Gingerbread Man on November 17th, 2017, 11:53 am, edited 1 time in total.

Richard1296
 
Posts: 42
Joined: July 29th, 2012, 2:25 pm

Post Posted November 17th, 2017, 10:50 am

That works great...I don't suppose there is a way to keep it from showing a tab
when I have more than one window open. Seems it counts open windows and tabs
as the same thing...so then it goes back to displaying a tab.
Not a deal breaker either way. I like it and am using the suggested work around.

Richard

Gingerbread Man

User avatar
 
Posts: 7636
Joined: January 30th, 2007, 10:55 am

Post Posted November 17th, 2017, 11:54 am

Richard1296 wrote:That works great...I don't suppose there is a way to keep it from showing a tab
when I have more than one window open.

Oh. Back to the drawing board! Replace Tab Tally with Yet Another Tab Counter, once again placing it before the first tab. Also replace the CSS code you have with the one in the edited post above.

Richard1296
 
Posts: 42
Joined: July 29th, 2012, 2:25 pm

Post Posted November 17th, 2017, 3:30 pm

WOW....Thank You Gingerbread Man...absolutely perfect. I don't see the little
icon that represents the number of open tabs , dunno if I lost it
or that's how it is supposed to be but I am not messing with anything...it works great.
Now one last request since you were so prompt with my last one.
Can you provide some winning lottery numbers.

Thanks
Richard

Gingerbread Man

User avatar
 
Posts: 7636
Joined: January 30th, 2007, 10:55 am

Post Posted November 18th, 2017, 8:09 am

Richard1296 wrote:I don't see the little icon that represents the number of open tabs , dunno if I lost it or that's how it is supposed to be

The above style hides it, except when in Customize mode. Since the add-on was only needed to hide the tab bar, I assumed you wouldn't want the counter icon there. If you actually do, delete this bit, starting with the last ,
Code: Select all
,
#main-window:not([customizing="true"]) toolbarbutton[label="Yet Another Tab Counter"]

Richard1296 wrote:Now one last request since you were so prompt with my last one.
Can you provide some winning lottery numbers.

:lol:

You're welcome.
———
Someone figured out a way to do without an add-on. Here is that style, with some tiny tweaks. As before, the title bar must be enabled for it to work. Additionally, the New Tab button and add-on buttons are hidden when you're not hovering the mouse cursor over the the tab bar.
Code: Select all
/*
Hide the tab bar when only one tab is open
https://www.reddit.com/r/FirefoxCSS/comments/7dqtuf/hide_tab_bar_if_only_one_tab_is_open/
*/

#tabbrowser-tabs,
#tabbrowser-tabs > .tabbrowser-arrowscrollbox,
#tabbrowser-tabs[positionpinnedtabs] > .tabbrowser-tab[pinned] {
  min-height: initial !important;
}

.tabbrowser-tab {
  line-height: 32px !important;
  height: 32px !important;
}

.tabbrowser-tab:only-of-type,
.tabs-newtab-button,
#tabbrowser-tabs ~ .toolbarbutton-1 {
  display: none !important;
}

#tabbrowser-tabs:hover .tabs-newtab-button,
#tabbrowser-tabs:hover ~ .toolbarbutton-1 {
  display: -moz-box !important;
}

brf
 
Posts: 15
Joined: October 4th, 2014, 6:53 am

Post Posted November 18th, 2017, 8:41 pm

What's the practical difference between the original version from Reddit, and your tweaked version? I'm using the one from Reddit right now and it seems to work perfectly so far.

Before that, I tried the addon-based one you posted and it had a lot of quirks - most of the time it worked fine, but sometimes it wouldn't show or hide in the right situations. Probably the fault of the addon I guess.

Thanks for posting this stuff.

Gingerbread Man

User avatar
 
Posts: 7636
Joined: January 30th, 2007, 10:55 am

Post Posted November 19th, 2017, 8:08 am

brf wrote:What's the practical difference between the original version from Reddit, and your tweaked version?

The only noteworthy change is that my tweak makes it work when there are add-on buttons on the tab bar (like the New Tab button, they only show on hover). Other than that, it's just minor code cleanup that you won't care about if you don't understand CSS.
brf wrote:Before that, I tried the addon-based one you posted and it had a lot of quirks - most of the time it worked fine, but sometimes it wouldn't show or hide in the right situations.

If you don't mind the New Tab button (and any add-on buttons on the tab bar) showing only on hover, then don't bother with the style I cobbled together in the beginning.

brf
 
Posts: 15
Joined: October 4th, 2014, 6:53 am

Post Posted November 19th, 2017, 5:12 pm

Ah, I don't normally use any addon buttons on the tab bar, so wouldn't have noticed that difference. Thanks.

SteveFL
New Member
 
Posts: 1
Joined: December 5th, 2017, 8:22 am

Post Posted December 5th, 2017, 8:29 am

Your code works great, including hiding the new tab button. One thing I noticed though is that it does not hide the private browsing icon. When I open a private window, the tab bar is there containing only the private browsing icon on the right. Is there any way to make it hide the tab bar with this icon as well?

Return to Firefox Support


Who is online

Users browsing this forum: Google [Bot] and 12 guests