Monday, June 7, 2021

Moving the tabs in the new Firefox

 So I upgraded my laptop today, the usual pacman -Syu, and got the new version of Firefox, version 89.0. For some reason, browser makers want to put the tabs ABOVE the address bar, which makes no sense, and lots of people are whining about it on the internet.  I did a bunch of googling and found this solution from Mozilla. That almost worked for this new version, but not quite, and they left out a major step. 

Here's the procedure: 

  1. In Firefox in the address bar, type about:support. Make a note of the location of your profile directory.
  2. Go to profile directory from step 1. Create a subdirectory named "chrome" if it doesn't already exist.
  3. Copy the userChrome.css mention in the solution link above by user cor-el (thanks, cor-el! I've also pasted my version below in case cor-el's version disappears for some reason).
  4. Paste the css you copied in step 3 into a file named 'userChrome.css" into the "chrome" directory you created in step 2.
  5. Open the userChrome.css file in your favorite editor (I recommend jEdit, of course).
  6. On line 20, there should be an entry for "--menubar-height", it is 0, which moved the tabs in the way of my bookmark bar. If you don't have the bookmark bar, you're probably good to go, almost -- keep reading. If you do, I changed --menubar-height to 41px. You'll also need to make this change in line 30 if you use full screen mode.
  7. I noticed that if I open several tabs, the tab bar would not expand across the window as expected. I changed line 45, width: 100wv to width: 1000wv, and now the tab bar expands across the window as expected.
  8. Save the file.
  9. In the Firefox address bar, type about:config, search for "toolkit.legacy", there should only be one result, toolkit.legacyUserProfileCustomizations.stylesheets. Change it to "true". This is necessary so Firefox will actually read your userChrome.css file at start up.
  10. Restart Firefox, you should be good to go.

I also noticed after doing this that the tab height is a little too short, so on line 14, I changed the --tab-min-height setting to 30 instead of 25. It also seems like the text in the tab isn't centered well vertically, so on line 54, I changed the 1px to 5 px, that looks better, I think.

You can play around with the other settings as needed to make you happy. I wasn't able to figure out how to make the tabs narrower by default, but they do resize correctly when you have many tabs open.

Here is the full contents of my userChrome.css file:



@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");

/* TABS: bottom - Firefox 65 and later - updated for 89+ */
/* https://searchfox.org/mozilla-release/source/browser/themes/shared/tabs.inc.css */
/* https://developer.mozilla.org/en-US/docs/Tools/Browser_Toolbox */

/* ROOT - VARS */
/* you can adjust the CSS variables until it looks correct */
/* you can use the Browser Toolbox to get the toolbar heights */

*|*:root {
  --tab-toolbar-navbar-overlap: 0px !important;

  --tab-min-height: 30px !important;
  --tab-min-width:  60px !important;

  --tab-caption: -5px; /* caption buttons on tab bar */
  --tab-adjust:   3px; /* adjust tab bar */

  --menubar-height: 41px; /*30px|41px=11px; caption buttons on menubar*/
  --navbar-height:  31px; /*31px*/
  --bookmarkbar-height: 26px;

  --tabbar-top: calc(var(--menubar-height) + var(--navbar-height) + var(--bookmarkbar-height) + var(--tab-adjust)); /*89+*/
}

/* in case you enable extra toolbars in full screen mode */
*|*:root[inFullscreen] {
  --tab-adjust: 3px;
  --menubar-height: 0px; /*30px*/
  --navbar-height:  31px; /*31px*/
  --bookmarkbar-height: 0px; /*26px*/
  --tabbar-top: calc(var(--menubar-height) + var(--navbar-height) + var(--bookmarkbar-height) + var(--tab-adjust)); /*89+*/
}

/* TAB BAR - below nav-bar */
#navigator-toolbox toolbar:not(#nav-bar):not(#toolbar-menubar) {-moz-box-ordinal-group:10}
#TabsToolbar {-moz-box-ordinal-group:1000}

#TabsToolbar {
  display: block !important;
  position: absolute !important;
/*  bottom: 0 !important; /* 68-88: BOTTOM */
  top: var(--tabbar-top);  /* 89+: TOP */
  width: 1000vw !important;
}

#tabbrowser-tabs {
  width: 100vw !important;
}

/* navigator-toolbox - PADDING */
*|*:root:not([chromehidden*="toolbar"]) #navigator-toolbox {
  padding-bottom: calc(var(--tab-min-height) + 1px) !important; /*ADJUST*/
  background-color: var(--toolbar-bgcolor) !important;
}

/* TabsToolbar with menubar and titlebar hidden - rules for Firefox 65-73 */
*|*:root[tabsintitlebar]:not([inFullscreen="true"]):not([sizemode="maximized"])
 #toolbar-menubar[autohide="true"] ~ #TabsToolbar{
}

/* TABS: height */
#tabbrowser-tabs,
#tabbrowser-tabs > .tabbrowser-arrowscrollbox,
.tabbrowser-tabs[positionpinnedtabs] > .tabbrowser-tab[pinned] {
  min-height: var(--tab-min-height) !important;
  max-height: var(--tab-min-height) !important;
}

#TabsToolbar {
  height: var(--tab-min-height) !important;
  margin-bottom: 1px !important;
  box-shadow: ThreeDShadow 0 -1px inset, -moz-dialog 0 1px !important; /*OPTIONAL*/
  background-color: var(--toolbar-bgcolor) !important;
  color:            var(--toolbar-color) !important;
  z-index: 1 !important;
}

/* indicators *//*
*|*:root[privatebrowsingmode=temporary] .private-browsing-indicator {
  position: absolute !important;
  display: block !important;
  right: 0px !important;
  bottom: 0px !important;
  width: 14px !important;
  pointer-events: none !important;
}
*/
.private-browsing-indicator {display: none !important;}
.accessibility-indicator    {display: none !important;}

/* Indicators - HIDE *//*
*|*:root:not([accessibilitymode])             .accessibility-indicator    {display: none !important}
*|*:root:not([privatebrowsingmode=temporary]) .private-browsing-indicator {display: none !important}
*/

/* Drag Space */
.titlebar-spacer[type="pre-tabs"],
.titlebar-spacer[type="post-tabs"] {
  width: 20px !important;
}

/* Override vertical shifts when moving a tab */
#navigator-toolbox[movingtab] > #titlebar > #TabsToolbar {
  padding-bottom: unset !important;
}

#navigator-toolbox[movingtab] #tabbrowser-tabs {
  padding-bottom: unset !important;
  margin-bottom: unset !important;
}

#navigator-toolbox[movingtab] > #nav-bar {
  margin-top: unset !important;
}

/* Hide window-controls and caption buttons on Tab Bar */
#TabsToolbar #window-controls {display: none !important;}
#TabsToolbar .titlebar-buttonbox-container {display: none !important;}

No comments: