Added an Arc-like empty tab that represents no state. [zen.urlbar.replace-newtab to false to disable]

This commit is contained in:
mr. M
2025-02-19 17:26:30 +01:00
parent e75e8d170d
commit ebdc9368da
10 changed files with 224 additions and 92 deletions

View File

@@ -14,6 +14,10 @@
:root:not([zen-no-padding='true']) & {
box-shadow: var(--zen-big-shadow);
}
& browser[transparent='true'] {
background: rgba(255, 255, 255, 0.1);
}
}
@media (-moz-bool-pref: 'zen.view.experimental-rounded-view') {

View File

@@ -256,6 +256,10 @@
& .tabbrowser-tab {
transition: scale 0.07s ease;
&[zen-empty-tab] {
display: none;
}
&:active {
scale: 0.98;
}

View File

@@ -254,7 +254,9 @@
const container = document.querySelector(
`#vertical-pinned-tabs-container .zen-workspace-tabs-section[zen-workspace-id="${pin.workspaceUuid}"]`
);
container.insertBefore(newTab, container.lastChild);
if (container) {
container.insertBefore(newTab, container.lastChild);
}
}
gBrowser.tabContainer._invalidateCachedTabs();
@@ -490,9 +492,8 @@
let nextTab = findNextTab(1) || findNextTab(-1);
if (!nextTab) {
ZenWorkspaces._createNewTabForWorkspace({ uuid: ZenWorkspaces.activeWorkspace });
nextTab = findNextTab(1) || findNextTab(-1);
ZenWorkspaces.selectEmptyTab();
return;
}
if (nextTab) {

View File

@@ -114,6 +114,21 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
);
}
selectEmptyTab() {
if (this._emptyTab) {
if (!Services.prefs.getBoolPref('zen.urlbar.replace-newtab')) {
let tab = gZenUIManager.openAndChangeToTab(Services.prefs.getStringPref('browser.startup.homepage'));
if (window.uuid) {
tab.setAttribute('zen-workspace-id', this.activeWorkspace);
}
return tab;
}
gBrowser.selectedTab = this._emptyTab;
return this._emptyTab;
}
return null;
}
async delayedStartup() {
if (!this.workspaceEnabled) {
return;
@@ -122,6 +137,13 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
await this.waitForPromises();
await this.initializeTabsStripSections();
this._resolveSectionsInitialized();
this._initializeEmptyTab();
}
_initializeEmptyTab() {
gBrowser._forZenEmptyTab = true;
this._emptyTab = gBrowser.addTrustedTab('about:blank', { inBackground: true });
this._emptyTab.setAttribute('zen-empty-tab', 'true');
}
registerPinnedResizeObserver() {
@@ -154,6 +176,14 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
}
get tabboxChildren() {
const childs = Array.from(this.tabboxChildrenWithoutEmpty);
if (this._emptyTab) {
childs.unshift(this._emptyTab);
}
return childs;
}
get tabboxChildrenWithoutEmpty() {
return this.activeWorkspaceStrip?.children || [];
}
@@ -615,26 +645,16 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
setTimeout(() => {
document.getElementById('cmd_closeWindow').doCommand();
}, 100);
return this._createNewTabForWorkspace({ uuid: workspaceID });
}
return null;
}
} else if (tabsPinned.length === 1 && tabsPinned[0] === tab) {
return this._createNewTabForWorkspace({ uuid: workspaceID });
return this.selectEmptyTab();
}
return null;
}
_createNewTabForWorkspace(window) {
let tab = gZenUIManager.openAndChangeToTab(Services.prefs.getStringPref('browser.startup.homepage'));
if (window.uuid) {
tab.setAttribute('zen-workspace-id', window.uuid);
}
return tab;
}
searchIcons(input, icons) {
input = input.toLowerCase();
@@ -1369,20 +1389,10 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
}
}
if (tabCount === 0) {
this._createNewTabForWorkspace(window);
this.selectEmptyTab();
}
}
_createNewTabForWorkspace(window) {
let tab = gZenUIManager.openAndChangeToTab(BROWSER_NEW_TAB_URL);
if (window.uuid) {
tab.setAttribute('zen-workspace-id', window.uuid);
}
return tab;
}
async saveWorkspaceFromCreate() {
let workspaceName = this._workspaceCreateInput.value;
if (!workspaceName) {
@@ -1474,6 +1484,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
// Refresh tab cache
gBrowser.verticalPinnedTabsContainer = this.pinnedTabsContainer;
gBrowser.tabContainer.verticalPinnedTabsContainer = this.pinnedTabsContainer;
// Move empty tab to the new workspace
this._moveEmptyTabToWorkspace(window.uuid);
this.tabContainer._invalidateCachedTabs();
if (!whileScrolling) {
await this._organizeWorkspaceStripLocations(previousWorkspace);
@@ -1490,6 +1503,13 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
await this._updateWorkspaceState(window, onInit, tabToSelect);
}
_moveEmptyTabToWorkspace(workspaceUuid) {
const emptyTab = this._emptyTab;
if (emptyTab) {
this.moveTabToWorkspace(emptyTab, workspaceUuid);
}
}
_updateMarginTopPinnedTabs(arrowscrollbox, pinnedContainer) {
if (arrowscrollbox) {
arrowscrollbox.style.marginTop = pinnedContainer.getBoundingClientRect().height + 'px';
@@ -1593,8 +1613,14 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
}
}
// If there's no more visible tabs, make a new tab visible
if (hiddenTabs.length === visibleTabs.length) {
this._createNewTabForWorkspace({ uuid: workspaceUuid });
// or if ALL the visible tabs are essentials or we have our selected
// tab hidden, select a new tab
if (
hiddenTabs.length === visibleTabs.length ||
visibleTabs.every((tab) => tab.getAttribute('zen-essential') === 'true') ||
hiddenTabs.includes(gBrowser.selectedTab)
) {
this.selectEmptyTab();
}
for (const tab of hiddenTabs) {
gBrowser.hideTab(tab, undefined, true);
@@ -1658,12 +1684,15 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
if (!tabToSelect && gBrowser.visibleTabs.length) {
tabToSelect = gBrowser.visibleTabs[gBrowser.visibleTabs.length - 1];
}
if (tabToSelect?.hasAttribute('zen-essential')) { // Never select an essential tab
tabToSelect = null;
}
}
// If we found a tab to select, select it
if (!onInit && !tabToSelect) {
// Create new tab if needed and no suitable tab was found
const newTab = this._createNewTabForWorkspace(window);
const newTab = this.selectEmptyTab();
tabToSelect = newTab;
}
if (tabToSelect) {
@@ -1785,9 +1814,10 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
}
updateShouldHideSeparator(arrowScrollbox, pinnedContainer) {
// <= 2 because we have the empty tab and the new tab button
const shouldHideSeparator =
pinnedContainer.children.length === 1 ||
Array.from(arrowScrollbox.children).filter((child) => !child.hasAttribute('hidden')).length === 1;
Array.from(arrowScrollbox.children).filter((child) => !child.hasAttribute('hidden')).length <= 2;
if (shouldHideSeparator) {
pinnedContainer.setAttribute('hide-separator', 'true');
} else {
@@ -1832,6 +1862,11 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
const tab = gBrowser.getTabForBrowser(browser);
const workspaceID = tab.getAttribute('zen-workspace-id');
const isEssential = tab.getAttribute('zen-essential') === 'true';
if (tab.hasAttribute('zen-empty-tab')) {
return;
}
if (!isEssential) {
const activeWorkspace = await parent.ZenWorkspaces.getActiveWorkspace();
if (!activeWorkspace) {
@@ -2125,6 +2160,10 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
return children;
}
if (this._allStoredTabs) {
return this._allStoredTabs;
}
const tabs = [];
// we need to go through each tab in each container
const essentialsContainer = document.getElementById('zen-essentials-container');
@@ -2138,7 +2177,8 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
}
}
}
return tabs;
this._allStoredTabs = tabs;
return this._allStoredTabs;
}
get pinnedTabCount() {

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/sessionstore/SessionStore.sys.mjs b/browser/components/sessionstore/SessionStore.sys.mjs
index 908743177d9f95e2e6549c689e7a493ca8668701..2dd53f5fdbffb21dfdc8bf68a6771d4ac0acd8be 100644
index 334c041c1748564094c6a177bb24f146791d96d8..c8f4ad6eeab4bf1ede6f23814d370d839ed83f76 100644
--- a/browser/components/sessionstore/SessionStore.sys.mjs
+++ b/browser/components/sessionstore/SessionStore.sys.mjs
@@ -2174,9 +2174,10 @@ var SessionStoreInternal = {
@@ -22,7 +22,7 @@ index 908743177d9f95e2e6549c689e7a493ca8668701..2dd53f5fdbffb21dfdc8bf68a6771d4a
// Restore the state into the new tab.
this.restoreTab(newTab, tabState, {
restoreImmediately: aRestoreImmediately,
@@ -5315,7 +5317,7 @@ var SessionStoreInternal = {
@@ -5315,14 +5317,14 @@ var SessionStoreInternal = {
}
let tabbrowser = aWindow.gBrowser;
@@ -31,3 +31,11 @@ index 908743177d9f95e2e6549c689e7a493ca8668701..2dd53f5fdbffb21dfdc8bf68a6771d4a
/** @type {WindowStateData} */
let winData = this._windows[aWindow.__SSi];
let tabsData = (winData.tabs = []);
// update the internal state data for this window
for (let tab of tabs) {
- if (tab == aWindow.FirefoxViewHandler.tab) {
+ if (tab == aWindow.FirefoxViewHandler.tab || tab.hasAttribute("zen-empty-tab")) {
continue;
}
let tabData = lazy.TabState.collect(tab, TAB_CUSTOM_VALUES.get(tab));

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/tabbrowser/content/tab.js b/browser/components/tabbrowser/content/tab.js
index d41c486c02a6f09dcff5741a59ad8b617294c481..abaccd1935fc117924c44dd22cae0b322fc6a0c4 100644
index d41c486c02a6f09dcff5741a59ad8b617294c481..e2320d9dd27f3d0caadbc2294d200ff0c5ea2de6 100644
--- a/browser/components/tabbrowser/content/tab.js
+++ b/browser/components/tabbrowser/content/tab.js
@@ -37,6 +37,7 @@
@@ -19,6 +19,24 @@ index d41c486c02a6f09dcff5741a59ad8b617294c481..abaccd1935fc117924c44dd22cae0b32
return;
}
@@ -204,7 +205,7 @@
}
get visible() {
- return this.isOpen && !this.hidden && !this.group?.collapsed;
+ return this.isOpen && !this.hidden && !this.group?.collapsed && !this.hasAttribute("zen-empty-tab");
}
get hidden() {
@@ -266,7 +267,7 @@
return false;
}
- return true;
+ return !this.hasAttribute("zen-empty-tab");
}
get lastAccessed() {
@@ -451,6 +452,7 @@
this.style.MozUserFocus = "ignore";
} else if (

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..e06b7ffb6c7769ad3f29e2c5aa05156a34fd7933 100644
index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..cb4a77fa5992b9890dfc55cb3c3c558d07912bb1 100644
--- a/browser/components/tabbrowser/content/tabbrowser.js
+++ b/browser/components/tabbrowser/content/tabbrowser.js
@@ -406,11 +406,52 @@
@@ -121,7 +121,17 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..e06b7ffb6c7769ad3f29e2c5aa05156a
return false;
}
@@ -2387,7 +2437,7 @@
@@ -2222,7 +2272,8 @@
b.setAttribute("name", name);
}
- if (this._allowTransparentBrowser) {
+ if (this._allowTransparentBrowser || this._forZenEmptyTab) {
+ delete this._forZenEmptyTab;
b.setAttribute("transparent", "true");
}
@@ -2387,7 +2438,7 @@
let panel = this.getPanel(browser);
let uniqueId = this._generateUniquePanelID();
@@ -130,7 +140,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..e06b7ffb6c7769ad3f29e2c5aa05156a
aTab.linkedPanel = uniqueId;
// Inject the <browser> into the DOM if necessary.
@@ -2446,8 +2496,8 @@
@@ -2446,8 +2497,8 @@
// If we transitioned from one browser to two browsers, we need to set
// hasSiblings=false on both the existing browser and the new browser.
if (this.tabs.length == 2) {
@@ -141,7 +151,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..e06b7ffb6c7769ad3f29e2c5aa05156a
} else {
aTab.linkedBrowser.browsingContext.hasSiblings = this.tabs.length > 1;
}
@@ -2679,6 +2729,12 @@
@@ -2679,6 +2730,12 @@
);
}
@@ -154,7 +164,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..e06b7ffb6c7769ad3f29e2c5aa05156a
if (!UserInteraction.running("browser.tabs.opening", window)) {
UserInteraction.start("browser.tabs.opening", "initting", window);
}
@@ -2742,6 +2798,12 @@
@@ -2742,6 +2799,12 @@
noInitialLabel,
skipBackgroundNotify,
});
@@ -167,7 +177,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..e06b7ffb6c7769ad3f29e2c5aa05156a
if (insertTab) {
// insert the tab into the tab container in the correct position
this._insertTabAtIndex(t, {
@@ -2885,6 +2947,9 @@
@@ -2885,6 +2948,9 @@
}
}
@@ -177,7 +187,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..e06b7ffb6c7769ad3f29e2c5aa05156a
// Additionally send pinned tab events
if (pinned) {
this._notifyPinnedStatus(t);
@@ -3403,6 +3468,21 @@
@@ -3403,6 +3469,21 @@
) {
tabWasReused = true;
tab = this.selectedTab;
@@ -199,7 +209,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..e06b7ffb6c7769ad3f29e2c5aa05156a
if (!tabData.pinned) {
this.unpinTab(tab);
} else {
@@ -3416,6 +3496,7 @@
@@ -3416,6 +3497,7 @@
restoreTabsLazily && !select && !tabData.pinned;
let url = "about:blank";
@@ -207,7 +217,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..e06b7ffb6c7769ad3f29e2c5aa05156a
if (tabData.entries?.length) {
let activeIndex = (tabData.index || tabData.entries.length) - 1;
// Ensure the index is in bounds.
@@ -3451,7 +3532,21 @@
@@ -3451,7 +3533,21 @@
skipLoad: true,
preferredRemoteType,
});
@@ -230,7 +240,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..e06b7ffb6c7769ad3f29e2c5aa05156a
if (select) {
tabToSelect = tab;
}
@@ -3464,8 +3559,8 @@
@@ -3464,8 +3560,8 @@
// inserted in the DOM. If the tab is not yet in the DOM,
// just insert it in the right place from the start.
if (!tab.parentNode) {
@@ -241,7 +251,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..e06b7ffb6c7769ad3f29e2c5aa05156a
tab.toggleAttribute("pinned", true);
this.tabContainer._invalidateCachedTabs();
// Then ensure all the tab open/pinning information is sent.
@@ -3729,7 +3824,7 @@
@@ -3729,7 +3825,7 @@
// Ensure we have an index if one was not provided.
if (typeof index != "number") {
// Move the new tab after another tab if needed, to the end otherwise.
@@ -250,7 +260,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..e06b7ffb6c7769ad3f29e2c5aa05156a
if (
!bulkOrderedOpen &&
((openerTab &&
@@ -3780,7 +3875,7 @@
@@ -3780,7 +3876,7 @@
}
/** @type {MozTabbrowserTab|undefined} */
@@ -259,7 +269,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..e06b7ffb6c7769ad3f29e2c5aa05156a
this.tabContainer._invalidateCachedTabs();
if (tabGroup) {
@@ -4095,6 +4190,9 @@
@@ -4095,6 +4191,9 @@
return;
}
@@ -269,7 +279,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..e06b7ffb6c7769ad3f29e2c5aa05156a
this.removeTabs(selectedTabs);
}
@@ -4427,6 +4525,7 @@
@@ -4427,6 +4526,7 @@
skipSessionStore,
} = {}
) {
@@ -277,7 +287,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..e06b7ffb6c7769ad3f29e2c5aa05156a
if (UserInteraction.running("browser.tabs.opening", window)) {
UserInteraction.finish("browser.tabs.opening", window);
}
@@ -4443,6 +4542,12 @@
@@ -4443,6 +4543,12 @@
TelemetryStopwatch.start("FX_TAB_CLOSE_TIME_NO_ANIM_MS", aTab);
}
@@ -290,7 +300,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..e06b7ffb6c7769ad3f29e2c5aa05156a
// Handle requests for synchronously removing an already
// asynchronously closing tab.
if (!animate && aTab.closing) {
@@ -4457,7 +4562,9 @@
@@ -4457,7 +4563,9 @@
// frame created for it (for example, by updating the visually selected
// state).
let tabWidth = window.windowUtils.getBoundsWithoutFlushing(aTab).width;
@@ -301,7 +311,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..e06b7ffb6c7769ad3f29e2c5aa05156a
if (
!this._beginRemoveTab(aTab, {
closeWindowFastpath: true,
@@ -4471,7 +4578,6 @@
@@ -4471,7 +4579,6 @@
TelemetryStopwatch.cancel("FX_TAB_CLOSE_TIME_NO_ANIM_MS", aTab);
return;
}
@@ -309,7 +319,16 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..e06b7ffb6c7769ad3f29e2c5aa05156a
let lockTabSizing =
!this.tabContainer.verticalMode &&
!aTab.pinned &&
@@ -4610,14 +4716,14 @@
@@ -4550,7 +4657,7 @@
skipSessionStore = false,
} = {}
) {
- if (aTab.closing || this._windowIsClosing) {
+ if (aTab.closing || this._windowIsClosing || aTab.hasAttribute("zen-empty-tab")) {
return false;
}
@@ -4610,14 +4717,14 @@
!!this.tabsInCollapsedTabGroups.length;
if (
aTab.visible &&
@@ -326,7 +345,18 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..e06b7ffb6c7769ad3f29e2c5aa05156a
if (closeWindow) {
// We've already called beforeunload on all the relevant tabs if we get here,
@@ -4812,6 +4918,8 @@
@@ -4681,9 +4788,7 @@
aTab._mouseleave();
if (newTab) {
- this.addTrustedTab(BROWSER_NEW_TAB_URL, {
- skipAnimation: true,
- });
+ ZenWorkspaces.selectEmptyTab();
} else {
TabBarVisibility.update();
}
@@ -4812,6 +4917,8 @@
this.tabs[i]._tPos = i;
}
@@ -335,7 +365,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..e06b7ffb6c7769ad3f29e2c5aa05156a
if (!this._windowIsClosing) {
if (wasPinned) {
this.tabContainer._positionPinnedTabs();
@@ -5465,10 +5573,10 @@
@@ -5465,10 +5572,10 @@
SessionStore.deleteCustomTabValue(aTab, "hiddenBy");
}
@@ -348,7 +378,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..e06b7ffb6c7769ad3f29e2c5aa05156a
aTab.selected ||
aTab.closing ||
// Tabs that are sharing the screen, microphone or camera cannot be hidden.
@@ -5706,9 +5814,9 @@
@@ -5706,9 +5813,9 @@
// Don't allow mixing pinned and unpinned tabs.
if (aTab.pinned) {
@@ -360,7 +390,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..e06b7ffb6c7769ad3f29e2c5aa05156a
}
if (aTab._tPos == aIndex) {
return;
@@ -5717,7 +5825,7 @@
@@ -5717,7 +5824,7 @@
this._lastRelatedTabMap = new WeakMap();
this._handleTabMove(aTab, () => {
@@ -369,7 +399,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..e06b7ffb6c7769ad3f29e2c5aa05156a
if (forceStandaloneTab && neighbor.group) {
neighbor = neighbor.group;
}
@@ -5802,7 +5910,7 @@
@@ -5802,7 +5909,7 @@
createLazyBrowser,
};
@@ -378,7 +408,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..e06b7ffb6c7769ad3f29e2c5aa05156a
if (aIndex < numPinned || (aTab.pinned && aIndex == numPinned)) {
params.pinned = true;
}
@@ -7443,6 +7551,7 @@
@@ -7443,6 +7550,7 @@
aWebProgress.isTopLevel
) {
this.mTab.setAttribute("busy", "true");
@@ -386,7 +416,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..e06b7ffb6c7769ad3f29e2c5aa05156a
gBrowser._tabAttrModified(this.mTab, ["busy"]);
this.mTab._notselectedsinceload = !this.mTab.selected;
gBrowser.syncThrobberAnimations(this.mTab);
@@ -8411,7 +8520,7 @@ var TabContextMenu = {
@@ -8411,7 +8519,7 @@ var TabContextMenu = {
);
contextUnpinSelectedTabs.hidden =
!this.contextTab.pinned || !multiselectionContext;
@@ -395,7 +425,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..e06b7ffb6c7769ad3f29e2c5aa05156a
// Move Tab items
let contextMoveTabOptions = document.getElementById(
"context_moveTabOptions"
@@ -8444,7 +8553,7 @@ var TabContextMenu = {
@@ -8444,7 +8552,7 @@ var TabContextMenu = {
let contextMoveTabToStart = document.getElementById("context_moveToStart");
let isFirstTab =
tabsToMove[0] == visibleTabs[0] ||
@@ -404,7 +434,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..e06b7ffb6c7769ad3f29e2c5aa05156a
contextMoveTabToStart.disabled = isFirstTab && allSelectedTabsAdjacent;
document.getElementById("context_openTabInWindow").disabled =
@@ -8677,6 +8786,7 @@ var TabContextMenu = {
@@ -8677,6 +8785,7 @@ var TabContextMenu = {
if (this.contextTab.multiselected) {
gBrowser.removeMultiSelectedTabs();
} else {

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/tabbrowser/content/tabs.js b/browser/components/tabbrowser/content/tabs.js
index 8aeb244ffca9f48661805f5b7d860b5896055562..ad66e10f9b1c359eadf859cda58280479bc6483f 100644
index 8aeb244ffca9f48661805f5b7d860b5896055562..b2e3b6c9c37eb1a070bbea72d629f9f72676f5bf 100644
--- a/browser/components/tabbrowser/content/tabs.js
+++ b/browser/components/tabbrowser/content/tabs.js
@@ -94,7 +94,7 @@
@@ -115,7 +115,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad66e10f9b1c359eadf859cda5828047
return this.#allTabs;
}
- let children = Array.from(this.arrowScrollbox.children);
+ let children = Array.from(ZenWorkspaces.tabboxChildren);
+ let children = ZenWorkspaces.tabboxChildren;
// remove arrowScrollbox periphery element
children.pop();
@@ -147,7 +147,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad66e10f9b1c359eadf859cda5828047
get allGroups() {
- let children = Array.from(this.arrowScrollbox.children);
+ let children = Array.from(ZenWorkspaces.tabboxChildren);
+ let children = ZenWorkspaces.tabboxChildren;
return children.filter(node => node.tagName == "tab-group");
}
@@ -160,7 +160,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad66e10f9b1c359eadf859cda5828047
- );
- let children = Array.from(this.arrowScrollbox.children);
+ let verticalPinnedTabsContainer = this.verticalPinnedTabsContainer;
+ let children = Array.from(ZenWorkspaces.tabboxChildren);
+ let children = Array.from(ZenWorkspaces.tabboxChildrenWithoutEmpty);
let focusableItems = [];
for (let child of children) {
@@ -172,7 +172,15 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad66e10f9b1c359eadf859cda5828047
...verticalPinnedTabsContainer.children,
...focusableItems,
];
@@ -1617,8 +1644,8 @@
@@ -1603,6 +1630,7 @@
_invalidateCachedTabs() {
this.#allTabs = null;
this._invalidateCachedVisibleTabs();
+ ZenWorkspaces._allStoredTabs = null;
}
_invalidateCachedVisibleTabs() {
@@ -1617,8 +1645,8 @@
#isContainerVerticalPinnedExpanded(tab) {
return (
this.verticalMode &&
@@ -183,7 +191,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad66e10f9b1c359eadf859cda5828047
);
}
@@ -1633,7 +1660,7 @@
@@ -1633,7 +1661,7 @@
if (node == null) {
// We have a container for non-tab elements at the end of the scrollbox.
@@ -192,7 +200,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad66e10f9b1c359eadf859cda5828047
}
node.before(tab);
@@ -1733,7 +1760,7 @@
@@ -1733,7 +1761,7 @@
// There are separate "new tab" buttons for horizontal tabs toolbar, vertical tabs and
// for when the tab strip is overflowed (which is shared by vertical and horizontal tabs);
// Attach the long click popup to all of them.
@@ -201,7 +209,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad66e10f9b1c359eadf859cda5828047
const newTab2 = this.newTabButton;
const newTabVertical = document.getElementById(
"vertical-tabs-newtab-button"
@@ -1816,7 +1843,7 @@
@@ -1816,7 +1844,7 @@
let rect = ele => {
return window.windowUtils.getBoundsWithoutFlushing(ele);
};
@@ -210,7 +218,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad66e10f9b1c359eadf859cda5828047
if (tab && rect(tab).width <= this._tabClipWidth) {
this.setAttribute("closebuttons", "activetab");
} else {
@@ -1828,10 +1855,12 @@
@@ -1828,10 +1856,12 @@
_handleTabSelect(aInstant) {
let selectedTab = this.selectedItem;
@@ -223,7 +231,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad66e10f9b1c359eadf859cda5828047
selectedTab._notselectedsinceload = false;
}
@@ -1843,7 +1872,7 @@
@@ -1843,7 +1873,7 @@
return;
}
@@ -232,7 +240,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad66e10f9b1c359eadf859cda5828047
if (!tabs.length) {
return;
}
@@ -1879,7 +1908,7 @@
@@ -1879,7 +1909,7 @@
if (isEndTab && !this._hasTabTempMaxWidth) {
return;
}
@@ -241,7 +249,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad66e10f9b1c359eadf859cda5828047
// Force tabs to stay the same width, unless we're closing the last tab,
// which case we need to let them expand just enough so that the overall
// tabbar width is the same.
@@ -1894,7 +1923,7 @@
@@ -1894,7 +1924,7 @@
let tabsToReset = [];
for (let i = numPinned; i < tabs.length; i++) {
let tab = tabs[i];
@@ -250,7 +258,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad66e10f9b1c359eadf859cda5828047
if (!isEndTab) {
// keep tabs the same width
tab.style.transition = "none";
@@ -1960,16 +1989,15 @@
@@ -1960,16 +1990,15 @@
// Move pinned tabs to another container when the tabstrip is toggled to vertical
// and when session restore code calls _positionPinnedTabs; update styling whenever
// the number of pinned tabs changes.
@@ -272,7 +280,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad66e10f9b1c359eadf859cda5828047
}
}
@@ -1977,9 +2005,7 @@
@@ -1977,9 +2006,7 @@
}
_resetVerticalPinnedTabs() {
@@ -283,7 +291,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad66e10f9b1c359eadf859cda5828047
if (!verticalTabsContainer.children.length) {
return;
@@ -1992,8 +2018,8 @@
@@ -1992,8 +2019,8 @@
}
_positionPinnedTabs() {
@@ -294,7 +302,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad66e10f9b1c359eadf859cda5828047
let absPositionHorizontalTabs =
this.overflowing && tabs.length > numPinned && numPinned > 0;
@@ -2003,6 +2029,7 @@
@@ -2003,6 +2030,7 @@
if (this.verticalMode) {
this._updateVerticalPinnedTabs();
} else if (absPositionHorizontalTabs) {
@@ -302,7 +310,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad66e10f9b1c359eadf859cda5828047
let layoutData = this._pinnedTabsLayoutCache;
let uiDensity = document.documentElement.getAttribute("uidensity");
if (!layoutData || layoutData.uiDensity != uiDensity) {
@@ -2074,7 +2101,7 @@
@@ -2074,7 +2102,7 @@
return;
}
@@ -311,7 +319,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad66e10f9b1c359eadf859cda5828047
let directionX = screenX > dragData.animLastScreenX;
let directionY = screenY > dragData.animLastScreenY;
@@ -2257,9 +2284,9 @@
@@ -2257,9 +2285,9 @@
}
let pinned = draggedTab.pinned;
@@ -324,7 +332,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad66e10f9b1c359eadf859cda5828047
pinned ? numPinned : undefined
);
@@ -2502,8 +2529,9 @@
@@ -2502,8 +2530,9 @@
);
}
@@ -336,7 +344,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad66e10f9b1c359eadf859cda5828047
return;
}
@@ -2668,9 +2696,9 @@
@@ -2668,9 +2697,9 @@
function newIndex(aTab, index) {
// Don't allow mixing pinned and unpinned tabs.
if (aTab.pinned) {
@@ -348,7 +356,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad66e10f9b1c359eadf859cda5828047
}
}
@@ -2754,7 +2782,7 @@
@@ -2754,7 +2783,7 @@
}
_notifyBackgroundTab(aTab) {
@@ -357,7 +365,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad66e10f9b1c359eadf859cda5828047
return;
}
@@ -2772,12 +2800,14 @@
@@ -2772,12 +2801,14 @@
selectedTab = {
left: selectedTab.left,
right: selectedTab.right,
@@ -373,7 +381,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad66e10f9b1c359eadf859cda5828047
selectedTab,
];
})
@@ -2794,8 +2824,11 @@
@@ -2794,8 +2825,11 @@
delete this._lastTabToScrollIntoView;
// Is the new tab already completely visible?
if (
@@ -387,7 +395,7 @@ index 8aeb244ffca9f48661805f5b7d860b5896055562..ad66e10f9b1c359eadf859cda5828047
) {
return;
}
@@ -2803,21 +2836,29 @@
@@ -2803,21 +2837,29 @@
if (this.arrowScrollbox.smoothScroll) {
// Can we make both the new tab and the selected tab completely visible?
if (

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/urlbar/UrlbarInput.sys.mjs b/browser/components/urlbar/UrlbarInput.sys.mjs
index 50968dc04b527438acf30151f0c2e92f8b45097c..ff77a2407b8ca628bcad06a9822ba2dbf0d43a51 100644
index 50968dc04b527438acf30151f0c2e92f8b45097c..7f3579d39e53a36135fbabb786a6e07f4e0945b0 100644
--- a/browser/components/urlbar/UrlbarInput.sys.mjs
+++ b/browser/components/urlbar/UrlbarInput.sys.mjs
@@ -67,6 +67,13 @@ XPCOMUtils.defineLazyPreferenceGetter(
@@ -107,7 +107,17 @@ index 50968dc04b527438acf30151f0c2e92f8b45097c..ff77a2407b8ca628bcad06a9822ba2db
if (where == "current") {
where = "tab";
} else if (where == "tab") {
@@ -3859,6 +3891,11 @@ export class UrlbarInput {
@@ -3320,6 +3352,9 @@ export class UrlbarInput {
) {
where = "current";
}
+ if (this.window.gBrowser.selectedTab.hasAttribute("zen-empty-tab")) {
+ return "tab"; // Always open in a new tab if the current tab is "our empty tab".
+ }
return where;
}
@@ -3859,6 +3894,11 @@ export class UrlbarInput {
}
_on_click(event) {
@@ -119,7 +129,7 @@ index 50968dc04b527438acf30151f0c2e92f8b45097c..ff77a2407b8ca628bcad06a9822ba2db
if (
event.target == this.inputField ||
event.target == this._inputContainer ||
@@ -3930,7 +3967,7 @@ export class UrlbarInput {
@@ -3930,7 +3970,7 @@ export class UrlbarInput {
}
}
@@ -128,7 +138,7 @@ index 50968dc04b527438acf30151f0c2e92f8b45097c..ff77a2407b8ca628bcad06a9822ba2db
this.view.autoOpen({ event });
} else {
if (this._untrimOnFocusAfterKeydown) {
@@ -3970,9 +4007,12 @@ export class UrlbarInput {
@@ -3970,9 +4010,12 @@ export class UrlbarInput {
}
_on_mousedown(event) {
@@ -142,7 +152,7 @@ index 50968dc04b527438acf30151f0c2e92f8b45097c..ff77a2407b8ca628bcad06a9822ba2db
if (
event.target != this.inputField &&
@@ -3982,8 +4022,8 @@ export class UrlbarInput {
@@ -3982,8 +4025,8 @@ export class UrlbarInput {
break;
}

View File

@@ -1,5 +1,5 @@
diff --git a/toolkit/content/widgets/tabbox.js b/toolkit/content/widgets/tabbox.js
index 033582a3badb65d50f58a11f8a259e28eaa04ef3..fc79b5fb64ad17c3446979aa017fffb7f8ac3467 100644
index 033582a3badb65d50f58a11f8a259e28eaa04ef3..ef634d76549f0fa4d5789e2bbfb9409f44767683 100644
--- a/toolkit/content/widgets/tabbox.js
+++ b/toolkit/content/widgets/tabbox.js
@@ -210,7 +210,7 @@
@@ -11,12 +11,21 @@ index 033582a3badb65d50f58a11f8a259e28eaa04ef3..fc79b5fb64ad17c3446979aa017fffb7
this._selectedPanel?.classList.add("deck-selected");
}
this.setAttribute("selectedIndex", val);
@@ -537,7 +537,7 @@
if (!tab) {
return;
}
- for (let otherTab of this.allTabs) {
+ for (let otherTab of ZenWorkspaces.allStoredTabs) {
if (otherTab != tab && otherTab.selected) {
otherTab._selected = false;
}
@@ -820,7 +820,7 @@
if (tab == startTab) {
return null;
}
- if (filter(tab)) {
+ if (filter(tab) && !tab.hasAttribute("zen-glance-tab")) {
+ if (filter(tab) && !tab.hasAttribute("zen-glance-tab") && !tab.hasAttribute("zen-empty-tab")) {
return tab;
}
}