Allowed renamed pinned tabs to persist across sessions

This commit is contained in:
mr. M
2025-02-17 21:43:30 +01:00
parent 15a056b466
commit b8baca2100
3 changed files with 18 additions and 7 deletions

View File

@@ -147,8 +147,6 @@
return; return;
} }
const workspaces = await ZenWorkspaces._workspaces();
const activeTab = gBrowser.selectedTab; const activeTab = gBrowser.selectedTab;
const pinnedTabsByUUID = new Map(); const pinnedTabsByUUID = new Map();
const pinsToCreate = new Set(pins.map((p) => p.uuid)); const pinsToCreate = new Set(pins.map((p) => p.uuid));
@@ -174,7 +172,21 @@
} }
} }
// Second pass: create new tabs for pins that don't have tabs // Second pass: For every existing tab, update its label
// and set 'zen-has-static-label' attribute if it's been edited
for (let pin of pins) {
const tab = pinnedTabsByUUID.get(pin.uuid);
if (!tab) {
continue;
}
if (pin.title && pin.editedTitle) {
gBrowser._setTabLabel(tab, pin.title);
tab.setAttribute('zen-has-static-label', 'true');
}
}
// Third pass: create new tabs for pins that don't have tabs
for (let pin of pins) { for (let pin of pins) {
if (!pinsToCreate.has(pin.uuid)) { if (!pinsToCreate.has(pin.uuid)) {
continue; // Skip pins that already have tabs continue; // Skip pins that already have tabs

View File

@@ -119,7 +119,7 @@
{ {
type: 'spring', type: 'spring',
bounce: 0, bounce: 0,
delay: getMotion().stagger(0.1, { startDelay: 0.3 }), delay: getMotion().stagger(0.1, { startDelay: 0.4 }),
} }
); );
document.getElementById('zen-welcome-page-sidebar-buttons').innerHTML = ''; document.getElementById('zen-welcome-page-sidebar-buttons').innerHTML = '';

View File

@@ -1,8 +1,8 @@
diff --git a/browser/components/sessionstore/TabState.sys.mjs b/browser/components/sessionstore/TabState.sys.mjs diff --git a/browser/components/sessionstore/TabState.sys.mjs b/browser/components/sessionstore/TabState.sys.mjs
index 8f7ed557e6aa61e7e16ed4a8d785ad5fe651b3d8..dc0fdf17952df397a684f8a1da2f71739d007350 100644 index 8f7ed557e6aa61e7e16ed4a8d785ad5fe651b3d8..83bf443ca158c07e05075777da02b7f228d83dff 100644
--- a/browser/components/sessionstore/TabState.sys.mjs --- a/browser/components/sessionstore/TabState.sys.mjs
+++ b/browser/components/sessionstore/TabState.sys.mjs +++ b/browser/components/sessionstore/TabState.sys.mjs
@@ -84,6 +84,14 @@ class _TabState { @@ -84,6 +84,13 @@ class _TabState {
tabData.groupId = tab.group.id; tabData.groupId = tab.group.id;
} }
@@ -12,7 +12,6 @@ index 8f7ed557e6aa61e7e16ed4a8d785ad5fe651b3d8..dc0fdf17952df397a684f8a1da2f7173
+ tabData.zenDefaultUserContextId = tab.getAttribute("zenDefaultUserContextId"); + tabData.zenDefaultUserContextId = tab.getAttribute("zenDefaultUserContextId");
+ tabData.zenPinnedEntry = tab.getAttribute("zen-pinned-entry"); + tabData.zenPinnedEntry = tab.getAttribute("zen-pinned-entry");
+ tabData.zenPinnedIcon = tab.getAttribute("zen-pinned-icon"); + tabData.zenPinnedIcon = tab.getAttribute("zen-pinned-icon");
+ tabData.zenHasStaticLabel = tab.getAttribute("zen-has-static-label");
+ +
tabData.searchMode = tab.ownerGlobal.gURLBar.getSearchMode(browser, true); tabData.searchMode = tab.ownerGlobal.gURLBar.getSearchMode(browser, true);