diff --git a/addon/chrome/content/preferences/appearance.xhtml b/addon/chrome/content/preferences/appearance.xhtml index f11f9df7..3f4e0743 100644 --- a/addon/chrome/content/preferences/appearance.xhtml +++ b/addon/chrome/content/preferences/appearance.xhtml @@ -63,6 +63,7 @@ + @@ -250,7 +251,7 @@ + @@ -302,6 +304,7 @@ + diff --git a/addon/chrome/content/tab/tab.js b/addon/chrome/content/tab/tab.js index 3e8c5731..818b7267 100644 --- a/addon/chrome/content/tab/tab.js +++ b/addon/chrome/content/tab/tab.js @@ -741,7 +741,7 @@ Tabmix.tabsUtils = { const tabsButtonWidth = this._newTabButtonWidth(false); const tsbo = this.tabBar.arrowScrollbox.scrollbox; - const tsboBaseWidth = tsbo.getBoundingClientRect().width; + const {width: tsboBaseWidth, x: tsboX} = tsbo.getBoundingClientRect(); const tabstripWidth = this.disAllowNewtabbutton ? tsboBaseWidth + this._newTabButtonWidth(true) : tsboBaseWidth; @@ -753,7 +753,7 @@ Tabmix.tabsUtils = { } if (isFirstRowWithPinnedTabs && firstNonPinnedTab) { - const stripWidthWithoutPinned = tabstripWidth - firstNonPinnedTab.getBoundingClientRect().x; + const stripWidthWithoutPinned = tabstripWidth - (firstNonPinnedTab.getBoundingClientRect().x - tsboX); const testNewMinWidth = calcMinWidth(stripWidthWithoutPinned, tabsButtonWidth, newMinWidth); if (testNewMinWidth > newMinWidth) { const widthForeNonPinnedTabs = calcMinWidth(stripWidthWithoutPinned, tabsButtonWidth); @@ -981,9 +981,10 @@ Tabmix.tabsUtils = { } }, - _overflow_max_width: 250, + _tab_overflow_width: 250, updateOverflowMaxWidth() { - if (!TabmixTabbar.widthFitTitle && gBrowser.visibleTabs.length > gBrowser._numPinnedTabs) { + if (!TabmixTabbar.widthFitTitle && Tabmix.prefs.getBoolPref("flexTabs_fitRow") && + gBrowser.visibleTabs.length > gBrowser._numPinnedTabs) { const tsbo = this.tabBar.arrowScrollbox.scrollbox; const tsboBaseWidth = tsbo.getBoundingClientRect().width; const minWidth = parseFloat(gTMPprefObserver.dynamicRules.width.style.getPropertyValue("min-width")); @@ -991,11 +992,11 @@ Tabmix.tabsUtils = { const padding = tab ? Tabmix.getStyle(tab, "paddingLeft") + Tabmix.getStyle(tab, "paddingRight") : 4; const maxTabsInRow = Math.floor(tsboBaseWidth / (minWidth + padding)); const newMaxWidth = Math.floor(1000 * tsboBaseWidth / maxTabsInRow) / 1000 - padding; - if (this._overflow_max_width !== newMaxWidth) { - this._overflow_max_width = newMaxWidth; + if (this._tab_overflow_width !== newMaxWidth) { + this._tab_overflow_width = newMaxWidth; const root = document.querySelector(":root"); this.tabBar.setAttribute("no-animation", ""); - root?.style.setProperty("--tabmix-overflow-max-width", newMaxWidth + "px"); + root?.style.setProperty("--tabmix-tab-overflow-width", newMaxWidth + "px"); setTimeout(() => this.tabBar.removeAttribute("no-animation"), 0); } } @@ -1491,6 +1492,15 @@ window.gTMPprefObserver = { } break; } + case "extensions.tabmix.flexTabs_fitRow": + if (prefValue) { + Tabmix.tabsUtils.updateOverflowMaxWidth(); + } else { + Tabmix.tabsUtils._tab_overflow_width = 250; + const root = document.querySelector(":root"); + root?.style.removeProperty("--tabmix-tab-overflow-width"); + } + break; case "browser.tabs.tabClipWidth": gBrowser.tabContainer._tabClipWidth = Services.prefs.getIntPref(prefName); gBrowser.tabContainer._updateCloseButtons(); diff --git a/addon/chrome/skin/general.css b/addon/chrome/skin/general.css index c99bee59..145b75cf 100644 --- a/addon/chrome/skin/general.css +++ b/addon/chrome/skin/general.css @@ -73,5 +73,5 @@ } #tabbrowser-tabs[orient="horizontal"][multibar]:not([widthFitTitle]) > #tabbrowser-arrowscrollbox > .tabbrowser-tab[fadein]:not([pinned]) { - max-width: var(--tabmix-overflow-max-width, 250px) !important; + max-width: var(--tabmix-tab-overflow-width, var(--tab-min-width)) !important; } diff --git a/addon/defaults/preferences/tabmix.js b/addon/defaults/preferences/tabmix.js index bc531efa..7b561123 100644 --- a/addon/defaults/preferences/tabmix.js +++ b/addon/defaults/preferences/tabmix.js @@ -118,6 +118,7 @@ pref("extensions.tabmix.styles.otherTab", '{"italic":false,"bold":false,"underli pref("extensions.tabmix.styles.progressMeter", '{"bg":true,"bgColor":"rgba(170,170,255,1)"}'); pref("extensions.tabmix.flexTabs", false); +pref("extensions.tabmix.flexTabs_fitRow", true); pref("extensions.tabmix.titlefrombookmark", false); diff --git a/types/extraTabmixUtils.d.ts b/types/extraTabmixUtils.d.ts index 1ae7e03c..00de3ea4 100644 --- a/types/extraTabmixUtils.d.ts +++ b/types/extraTabmixUtils.d.ts @@ -475,7 +475,7 @@ declare namespace TabsUtils { function isSingleRow(visibleTabs: Tab[]): boolean; let _resizeObserver: ResizeObserver | null; function resizeObserver(observe: boolean): void; - let _overflow_max_width: number; + let _tab_overflow_width: number; function updateOverflowMaxWidth(): void; function updateScrollButtons(useTabmixButtons: boolean): void; function isElementVisible(element: Tab | null | undefined): boolean;