From 18944d5ed83f3e383bf63e6153f58e58159c66fd Mon Sep 17 00:00:00 2001 From: "mr. m" Date: Wed, 28 May 2025 10:17:33 +0200 Subject: [PATCH 1/6] fix: Fixed pinned tab icons not appearing at startup, b=(no-bug), c=tabs --- src/zen/tabs/ZenPinnedTabManager.mjs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/zen/tabs/ZenPinnedTabManager.mjs b/src/zen/tabs/ZenPinnedTabManager.mjs index b981007a4..e57fb3868 100644 --- a/src/zen/tabs/ZenPinnedTabManager.mjs +++ b/src/zen/tabs/ZenPinnedTabManager.mjs @@ -90,10 +90,11 @@ onTabIconChanged(tab, url = null) { const iconUrl = url ?? tab.iconImage.src; - if (!iconUrl) { + if (!iconUrl && tab.hasAttribute('zen-pin-id')) { try { setTimeout(async () => { try { + await this.promisePinnedCacheInitialized; const pin = this._pinsCache?.find( (pin) => pin.uuid === tab.getAttribute('zen-pin-id') ); @@ -162,6 +163,9 @@ await gZenWorkspaces.promiseSectionsInitialized; await this._initializePinsCache(); await this._initializePinnedTabs(init); + if (init) { + this._resolveInitializedPinnedCache(); + } } async _initializePinsCache() { @@ -637,17 +641,12 @@ this.resetPinChangedUrl(tab); } - async getFaviconAsBase64(pageUrl, secondTry = false) { + async getFaviconAsBase64(pageUrl) { try { const faviconData = await PlacesUtils.favicons.getFaviconForPage(pageUrl); if (!faviconData) { - if (secondTry || pageUrl.spec.startsWith('about:')) { - // empty favicon - return 'data:image/png;base64,'; - } - // Try again with the domain - const domainUrl = pageUrl.spec.substring(0, pageUrl.spec.indexOf('/')); - return await this.getFaviconAsBase64(Services.io.newURI(domainUrl), true); + // empty favicon + return 'data:image/png;base64,'; } return faviconData.dataURI; } catch (ex) { @@ -1135,4 +1134,8 @@ } window.gZenPinnedTabManager = new ZenPinnedTabManager(); + + gZenPinnedTabManager.promisePinnedCacheInitialized = new Promise((resolve) => { + gZenPinnedTabManager._resolveInitializedPinnedCache = resolve; + }); } From 21f3ab23d3d763f88b682fd9920529b283f19f75 Mon Sep 17 00:00:00 2001 From: "mr. m" Date: Wed, 28 May 2025 14:17:20 +0200 Subject: [PATCH 2/6] feat: Inherti the split view type when opening a new link, b=(no-bug), c=split-view --- src/browser/app/profile/browser.inc | 3 +++ src/browser/app/profile/features.inc | 2 +- src/browser/components/preferences/zen-settings.js | 2 +- src/browser/themes/shared/zen-icons/icons.css | 5 +++++ src/zen/split-view/ZenViewSplitter.mjs | 12 ++++++++---- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/browser/app/profile/browser.inc b/src/browser/app/profile/browser.inc index a3fd17cdd..69f49d510 100644 --- a/src/browser/app/profile/browser.inc +++ b/src/browser/app/profile/browser.inc @@ -50,3 +50,6 @@ pref("app.update.checkInstallTime.days", 6); // TODO: Check this out! pref("browser.profiles.enabled", false); pref("browser.tabs.groups.enabled", false); + +// Open new download in the current tabs +pref("browser.link.open_newwindow", 1); diff --git a/src/browser/app/profile/features.inc b/src/browser/app/profile/features.inc index 19078f491..f92e9ba98 100644 --- a/src/browser/app/profile/features.inc +++ b/src/browser/app/profile/features.inc @@ -22,7 +22,7 @@ pref('zen.mediacontrols.enabled', true); // Exposure: pref('zen.haptic-feedback.enabled', true); -pref('zen.mods.auto-update-days', 12); // In days +pref('zen.mods.auto-update-days', 20); // In days #ifdef MOZILLA_OFFICIAL pref('zen.mods.auto-update', true); pref('zen.rice.api.url', 'https://share.zen-browser.app', locked); diff --git a/src/browser/components/preferences/zen-settings.js b/src/browser/components/preferences/zen-settings.js index f5f6e4919..179637919 100644 --- a/src/browser/components/preferences/zen-settings.js +++ b/src/browser/components/preferences/zen-settings.js @@ -209,7 +209,7 @@ var gZenMarketplaceManager = { for (const mod of Object.values(mods)) { mod.modId = mod.id; - window.ZenInstallMod(mod); + await window.ZenInstallMod(mod); } } catch (error) { console.error('[ZenSettings:ZenMods]: Error while importing mods:', error); diff --git a/src/browser/themes/shared/zen-icons/icons.css b/src/browser/themes/shared/zen-icons/icons.css index 3991eb85a..9cf05d3ea 100644 --- a/src/browser/themes/shared/zen-icons/icons.css +++ b/src/browser/themes/shared/zen-icons/icons.css @@ -435,6 +435,11 @@ #zen-glance-sidebar-split { list-style-image: url('split.svg'); + + &[disabled='true'] { + opacity: 0.5; + cursor: not-allowed; + } } #sidebar-box[sidebarcommand='viewTabsSidebar'] diff --git a/src/zen/split-view/ZenViewSplitter.mjs b/src/zen/split-view/ZenViewSplitter.mjs index ffa68222f..c67b4fa71 100644 --- a/src/zen/split-view/ZenViewSplitter.mjs +++ b/src/zen/split-view/ZenViewSplitter.mjs @@ -897,7 +897,9 @@ class ZenViewSplitter extends ZenDOMOperatedFeature { tabCount: window.gBrowser.selectedTabs.length, }); document.getElementById('context_zenSplitTabs').setAttribute('data-l10n-args', tabCountInfo); - document.getElementById('context_zenSplitTabs').disabled = !this.contextCanSplitTabs(); + document + .getElementById('context_zenSplitTabs') + .setAttribute('disabled', !this.contextCanSplitTabs()); }); } @@ -951,7 +953,7 @@ class ZenViewSplitter extends ZenDOMOperatedFeature { window.gContextMenu.target.ownerDocument.location.href; const currentTab = gZenGlanceManager.getTabOrGlanceParent(window.gBrowser.selectedTab); const newTab = this.openAndSwitchToTab(url, { inBackground: false }); - this.splitTabs([currentTab, newTab], 'grid', 1); + this.splitTabs([currentTab, newTab], undefined, 1); } /** @@ -1028,7 +1030,7 @@ class ZenViewSplitter extends ZenDOMOperatedFeature { * Splits the given tabs. * * @param {Tab[]} tabs - The tabs to split. - * @param {string} gridType - The type of grid layout. + * @param {string|undefined} gridType - The type of grid layout. */ splitTabs(tabs, gridType, initialIndex = 0) { // TODO: Add support for splitting essential tabs @@ -1874,9 +1876,11 @@ class ZenViewSplitter extends ZenDOMOperatedFeature { } maybeDisableOpeningTabOnSplitView() { + const shouldBeDisabled = !this.canOpenLinkInSplitView(); document .getElementById('cmd_zenSplitViewLinkInNewTab') - .setAttribute('disabled', !this.canOpenLinkInSplitView()); + .setAttribute('disabled', shouldBeDisabled); + document.getElementById('zen-glance-sidebar-split').setAttribute('disabled', shouldBeDisabled); } canOpenLinkInSplitView() { From cbb1a4bc4426e7f5bff641174e3cb86a4d45db86 Mon Sep 17 00:00:00 2001 From: "mr. m" Date: Wed, 28 May 2025 17:13:21 +0200 Subject: [PATCH 3/6] feat: Remove border from menu popups, b=(no-bug), c=common --- src/zen/common/styles/zen-popup.css | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/zen/common/styles/zen-popup.css b/src/zen/common/styles/zen-popup.css index 72268d333..fc21f5e22 100644 --- a/src/zen/common/styles/zen-popup.css +++ b/src/zen/common/styles/zen-popup.css @@ -243,11 +243,6 @@ panel { opacity: 0; } -menupopup::part(content), -panel::part(content) { - border: var(--zen-appcontent-border); -} - menupopup, panel { box-shadow: none; From 03ca00748c15019c007b1a5744f6e1292c9b9aa0 Mon Sep 17 00:00:00 2001 From: "mr. m" Date: Wed, 28 May 2025 17:59:51 +0200 Subject: [PATCH 4/6] fix: Fixed inserting changed titles into pinned database, b=(no-bug), c=tabs --- src/browser/app/profile/browser.inc | 3 --- src/browser/components/tabbrowser/content/tabs-js.patch | 4 ++-- src/zen/tabs/ZenPinnedTabManager.mjs | 2 +- src/zen/tabs/ZenPinnedTabsStorage.mjs | 4 ++-- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/browser/app/profile/browser.inc b/src/browser/app/profile/browser.inc index 69f49d510..a3fd17cdd 100644 --- a/src/browser/app/profile/browser.inc +++ b/src/browser/app/profile/browser.inc @@ -50,6 +50,3 @@ pref("app.update.checkInstallTime.days", 6); // TODO: Check this out! pref("browser.profiles.enabled", false); pref("browser.tabs.groups.enabled", false); - -// Open new download in the current tabs -pref("browser.link.open_newwindow", 1); diff --git a/src/browser/components/tabbrowser/content/tabs-js.patch b/src/browser/components/tabbrowser/content/tabs-js.patch index fcf4d7df9..5a5c695f2 100644 --- a/src/browser/components/tabbrowser/content/tabs-js.patch +++ b/src/browser/components/tabbrowser/content/tabs-js.patch @@ -1,5 +1,5 @@ diff --git a/browser/components/tabbrowser/content/tabs.js b/browser/components/tabbrowser/content/tabs.js -index 84d633471c89230b981d8a07babef4e0c76c0338..ac51c64014b805e2130ffe6698b439b5df1b6d78 100644 +index 84d633471c89230b981d8a07babef4e0c76c0338..de8b1ecf7cb844f6cf3e66a41b6024c574dfc103 100644 --- a/browser/components/tabbrowser/content/tabs.js +++ b/browser/components/tabbrowser/content/tabs.js @@ -83,7 +83,7 @@ @@ -195,7 +195,7 @@ index 84d633471c89230b981d8a07babef4e0c76c0338..ac51c64014b805e2130ffe6698b439b5 + if (glanceTab) { + // insert right after the parent tab. note: it must be inserted before + // the last pinned tab so it can be inserted in the correct order -+ allTabs.splice(Math.max(i++, lastPinnedTabIdx), 0, glanceTab); ++ allTabs.splice(Math.max(i++ + 1, lastPinnedTabIdx), 0, glanceTab); + } else if (tab.classList.contains("vertical-pinned-tabs-container-separator")) { + // remove the separator from the list + allTabs.splice(i, 1); diff --git a/src/zen/tabs/ZenPinnedTabManager.mjs b/src/zen/tabs/ZenPinnedTabManager.mjs index e57fb3868..56ef429d2 100644 --- a/src/zen/tabs/ZenPinnedTabManager.mjs +++ b/src/zen/tabs/ZenPinnedTabManager.mjs @@ -953,7 +953,7 @@ } else { tab.setAttribute('zen-pinned-changed', 'true'); } - tab.style.setProperty('--zen-original-tab-icon', `url(${pin.iconUrl})`); + tab.style.setProperty('--zen-original-tab-icon', `url(${pin.iconUrl.spec})`); } removeTabContainersDragoverClass() { diff --git a/src/zen/tabs/ZenPinnedTabsStorage.mjs b/src/zen/tabs/ZenPinnedTabsStorage.mjs index e1c5c0d41..5dc81b93b 100644 --- a/src/zen/tabs/ZenPinnedTabsStorage.mjs +++ b/src/zen/tabs/ZenPinnedTabsStorage.mjs @@ -109,8 +109,8 @@ var ZenPinnedTabsStorage = { ` INSERT OR REPLACE INTO zen_pins ( uuid, title, url, container_id, workspace_uuid, position, - is_essential, is_group, parent_uuid, created_at, updated_at, - edited_title + is_essential, is_group, parent_uuid, edited_title, created_at, + updated_at ) VALUES ( :uuid, :title, :url, :container_id, :workspace_uuid, :position, :is_essential, :is_group, :parent_uuid, :edited_title, From 663243264bca5ee6d74ff25a1ebc984d1c8d5c89 Mon Sep 17 00:00:00 2001 From: "mr. m" Date: Wed, 28 May 2025 18:19:49 +0200 Subject: [PATCH 5/6] feat: Prevent zen's session restore from being removed, b=(no-bug), c=common --- src/zen/common/ZenSessionStore.mjs | 54 +----------------------------- 1 file changed, 1 insertion(+), 53 deletions(-) diff --git a/src/zen/common/ZenSessionStore.mjs b/src/zen/common/ZenSessionStore.mjs index 447a169b5..73c26ee08 100644 --- a/src/zen/common/ZenSessionStore.mjs +++ b/src/zen/common/ZenSessionStore.mjs @@ -7,7 +7,6 @@ this.#waitAndCleanup(); } - #glanceTabs = {}; promiseInitialized = new Promise((resolve) => { this._resolveInitialized = resolve; }); @@ -34,67 +33,16 @@ if (tabData.zenPinnedEntry) { tab.setAttribute('zen-pinned-entry', tabData.zenPinnedEntry); } - if (tabData.zenGlanceId) { - // We just found the background used for glance. Find - // the current - if (tabData.zenIsGlance) { - if (this.#glanceTabs[tabData.zenGlanceId]) { - this.#glanceTabs[tabData.zenGlanceId].tab = tab; - } else { - this.#glanceTabs[tabData.zenGlanceId] = { - tab: tab, - background: null, - }; - } - } else { - if (this.#glanceTabs[tabData.zenGlanceId]) { - this.#glanceTabs[tabData.zenGlanceId].background = tab; - } else { - this.#glanceTabs[tabData.zenGlanceId] = { - tab: null, - background: tab, - }; - } - } - } - } - - async #resolveGlanceTabs() { - for (const [id, data] of Object.entries(this.#glanceTabs)) { - const { tab, background } = data; - // TODO(Restore glance tab): Finish this implementation - continue; - - if (!tab || !background) { - tab?.removeAttribute('glance-id'); - background?.removeAttribute('glance-id'); - continue; - } - console.log(tab, background); - const browserRect = gBrowser.tabbox.getBoundingClientRect(); - await gZenGlanceManager.openGlance( - { - url: undefined, - clientX: browserRect.width / 2, - clientY: browserRect.height / 2, - width: 0, - height: 0, - }, - tab, - background - ); - } } async #waitAndCleanup() { await SessionStore.promiseAllWindowsRestored; - await this.#resolveGlanceTabs(); + await SessionStore.promiseInitialized; this.#cleanup(); } #cleanup() { this._resolveInitialized(); - delete window.gZenSessionStore; } } From d5e2acfd5ba0c3b87215faca67614b300c829c4f Mon Sep 17 00:00:00 2001 From: CosmoCreeper <179134799+CosmoCreeper@users.noreply.github.com> Date: Wed, 28 May 2025 19:00:51 -0400 Subject: [PATCH 6/6] Add a unique id to the checkbox for auto-updating Zen Mods on startup. (#8661) * Updated id to be unique. Signed-off-by: CosmoCreeper <179134799+CosmoCreeper@users.noreply.github.com> * Replaced unique id with one that doesn't contain enabled. Signed-off-by: CosmoCreeper <179134799+CosmoCreeper@users.noreply.github.com> --------- Signed-off-by: CosmoCreeper <179134799+CosmoCreeper@users.noreply.github.com> --- src/browser/components/preferences/zenMarketplace.inc.xhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/browser/components/preferences/zenMarketplace.inc.xhtml b/src/browser/components/preferences/zenMarketplace.inc.xhtml index 0e84c78d0..f2a4dedba 100644 --- a/src/browser/components/preferences/zenMarketplace.inc.xhtml +++ b/src/browser/components/preferences/zenMarketplace.inc.xhtml @@ -20,7 +20,7 @@