This commit is contained in:
Mr. M
2025-05-29 08:41:00 +02:00
10 changed files with 34 additions and 79 deletions

View File

@@ -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);

View File

@@ -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);

View File

@@ -20,7 +20,7 @@
<button id="zenThemeMarketplaceCheckForUpdates" data-l10n-id="zen-theme-marketplace-check-for-updates-button" />
</hbox>
<checkbox id="zenWorkspacesForceContainerTabsToWorkspace"
<checkbox id="zenThemeMarketplaceAutoUpdate"
data-l10n-id="zen-themes-auto-update"
preference="zen.mods.auto-update"/>

View File

@@ -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);

View File

@@ -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']

View File

@@ -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;
}
}

View File

@@ -243,11 +243,6 @@ panel {
opacity: 0;
}
menupopup::part(content),
panel::part(content) {
border: var(--zen-appcontent-border);
}
menupopup,
panel {
box-shadow: none;

View File

@@ -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() {

View File

@@ -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) {
@@ -954,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() {
@@ -1135,4 +1134,8 @@
}
window.gZenPinnedTabManager = new ZenPinnedTabManager();
gZenPinnedTabManager.promisePinnedCacheInitialized = new Promise((resolve) => {
gZenPinnedTabManager._resolveInitializedPinnedCache = resolve;
});
}

View File

@@ -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,