Skip to content

Instantly share code, notes, and snippets.

@urbanhusky
Last active July 14, 2022 15:23
Show Gist options
  • Save urbanhusky/1d63c45052d7cecf0ba9856f2ab69953 to your computer and use it in GitHub Desktop.
Save urbanhusky/1d63c45052d7cecf0ba9856f2ab69953 to your computer and use it in GitHub Desktop.
Firefox 95 ultra-compact multirow tabs on top, context line below tab & compact menus - urbanhusky's ugly hack YMMV :)
/* Hi, urbanhusky here.
This is cobbled together from various sources.
One of those sources is: https://github.com/MrOtherGuy/firefox-csshacks
*/
/* Source file https://github.com/MrOtherGuy/firefox-csshacks/tree/master/chrome/multi-row_tabs.css made available under Mozilla Public License v. 2.0
See the above repository for updates as well as full license text. */
/* Makes tabs to appear on multiple lines */
/* Tab reordering will not work and can't be made to work */
/* You can use multi-row_tabs_window_control_patch.css to move window controls to nav-bar*/
/* You might want to move tabs-new-tab-button outside tabs toolbar for smoother behavior */
/* Change the --multirow-n-rows to change maximum number of rows before the rows will start to scroll */
:root{
--multirow-n-rows: 5;
--multirow-tab-min-width: 76px;
--multirow-tab-dynamic-width: 0; /* Change to 0 for fixed-width tabs using the above width. */
/* urbanhusky hacks */
--inline-tab-padding: 2px; /* less space wasted left/right inside tab */
--tab-label-mask-size: 1em; /* less fading */
}
/* Scrollbar can't be clicked but the rows can be scrolled with mouse wheel */
/* Uncomment the next line if you want to be able to use the scrollbar with mouse clicks */
/* #tabbrowser-arrowscrollbox{ -moz-window-dragging: no-drag } */
/* Uncommenting the above makes you unable to drag the window from empty space in the tab strip but normal draggable spaces will continue to work */
#tabbrowser-tabs{
min-height: unset !important;
padding-inline-start: 0px !important
}
/* urbanhusky hack: make tabs *much* more compact */
.tabbrowser-tab{
height: var(--tab-min-height);
/* border-top: 0; /* remove top-border on tabs (causes grey line on dark theme */
}
/* uh: prevent scrollbar on multirow tabs with smaller tabs */
#TabsToolbar {
--toolbarbutton-inner-padding: calc((var(--tab-min-height) - 8px) / 2) !important; /* add a little space to prevent scrollbar when not yet needed */
}
/* Adjust tab corner shape, optionally remove space below tabs */
#tabbrowser-tabs {
--user-tab-rounding: 4px;
}
/* Move container color bar to bottom of tab */
.tabbrowser-tab[usercontextid] > .tab-stack > .tab-background > .tab-context-line {
margin-top: calc(var(--tab-min-height) - 2px) !important;
}
/*** Tighten up drop-down/context/popup menu spacing (8 Sep 2021) ***/
menupopup:not(.in-menulist) > menuitem,
menupopup:not(.in-menulist) > menu {
padding-block: 4px !important; /* reduce to 3px, 2px, 1px or 0px as needed */
min-height: unset !important; /* v92.0 - for padding below 4px */
}
:root {
--arrowpanel-menuitem-padding: 4px 8px !important;
}
@-moz-document url(chrome://browser/content/browser.xhtml){
#scrollbutton-up~spacer,
#scrollbutton-up,
#scrollbutton-down{ display: var(--scrollbutton-display-model,initial) }
scrollbox[part][orient="horizontal"]{
display: flex;
flex-wrap: wrap;
overflow-y: auto;
max-height: calc((var(--tab-min-height) + 2 * var(--tab-block-margin,0px)) * var(--multirow-n-rows));
scrollbar-color: currentColor transparent;
scrollbar-width: thin;
scroll-snap-type: y mandatory;
}
}
.scrollbox-clip[orient="horizontal"],
#tabbrowser-arrowscrollbox{
overflow: -moz-hidden-unscrollable;
display: block;
--scrollbutton-display-model: none;
}
.tabbrowser-tab{ scroll-snap-align: start; }
#tabbrowser-tabs .tabbrowser-tab[pinned]{
position: static !important;
margin-inline-start: 0px !important;
}
.tabbrowser-tab[fadein]:not([pinned]){
min-width: var(--multirow-tab-min-width) !important;
flex-grow: var(--multirow-tab-dynamic-width);
/*
Uncomment to enable full-width tabs, also makes tab dragging a tiny bit more sensible
Don't set to none or you'll see errors in console when closing tabs
*/
/*max-width: 100vw !important;*/
}
.tabbrowser-tab > stack{ width: 100%; height: 100% }
/* remove bottom margin so it doesn't throw off row height computation */
#tabs-newtab-button{ margin-bottom: 0 !important; }
#alltabs-button,
:root:not([customizing]) #TabsToolbar #new-tab-button,
#tabbrowser-arrowscrollbox > spacer,
.tabbrowser-tab::after{ display: none !important }
/*** Audio Playing / Mute Button when sound is playing (urbanhusky hack: without this the button does not even show) ***/
#TabsToolbar {
--user-mute-button-height: 16px; /* default size is 12px, site icon is 16px */
}
/* enlarge it */
.tab-icon-overlay:not([pinned], [sharing], [crashed]):is([soundplaying], [muted]) {
width: var(--user-mute-button-height) !important;
height: var(--user-mute-button-height) !important;
/* margin-left: calc(var(--user-mute-button-height) / 2 + 2px) !important; /* pushes icon to the right */
/* margin-right: 2px !important; /* closes up some space before the text */
padding: 0 !important; /* allows icon to expand to full size */
}
/* Color the icon on hover for confirmation or avoidance */
.tab-icon-overlay:not([pinned], [sharing], [crashed]):is([soundplaying], [muted]):hover {
fill: green !important;
}
[lwthemetextcolor="bright"] .tab-icon-overlay:not([pinned], [sharing], [crashed]):is([soundplaying], [muted]):hover {
fill: lightgreen !important; /* for dark themes */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment