This commit is contained in:
mr. m
2025-04-25 15:21:32 +02:00
22 changed files with 7329 additions and 69 deletions

View File

@@ -339,7 +339,7 @@ pref("network.http.rcwn.enabled", false);
pref("devtools.debugger.remote-enabled", false);
pref("devtools.chrome.enabled", true);
// Disable firefox's revamp
// Disable Firefox's revamp
pref("sidebar.revamp", false, locked);
pref("sidebar.verticalTabs", false, locked);

View File

@@ -170,7 +170,6 @@ var gZenMarketplaceManager = {
for (const theme of Object.values(themes).sort((a, b) => a.name.localeCompare(b.name))) {
const sanitizedName = `theme-${theme.name?.replaceAll(/\s/g, '-')?.replaceAll(/[^A-z_-]+/g, '')}`;
const isThemeEnabled = theme.enabled === undefined || theme.enabled;
const fragment = window.MozXULElement.parseXULToFragment(`
<vbox class="zenThemeMarketplaceItem">
<vbox class="zenThemeMarketplaceItemContent">
@@ -181,6 +180,7 @@ var gZenMarketplaceManager = {
</vbox>
<hbox class="zenThemeMarketplaceItemActions">
${theme.preferences ? `<button id="zenThemeMarketplaceItemConfigureButton-${sanitizedName}" class="zenThemeMarketplaceItemConfigureButton" hidden="true"></button>` : ''}
${theme.homepage ? `<button id="zenThemeMarketplaceItemHomePageLink-${sanitizedName}" class="zenThemeMarketplaceItemHomepageButton" zen-theme-id="${theme.id}"></button>` : ''}
<button class="zenThemeMarketplaceItemUninstallButton" data-l10n-id="zen-theme-marketplace-remove-button" zen-theme-id="${theme.id}"></button>
</hbox>
</vbox>
@@ -274,6 +274,16 @@ var gZenMarketplaceManager = {
await this.removeTheme(event.target.getAttribute('zen-theme-id'));
});
if (theme.homepage) {
const homepageButton = fragment.querySelector('.zenThemeMarketplaceItemHomepageButton');
homepageButton.addEventListener('click', () => {
// open the homepage url in a new tab
const url = theme.homepage;
window.open(url, '_blank');
});
}
if (theme.preferences) {
fragment.querySelector('.zenThemeMarketplaceItemConfigureButton').addEventListener('click', () => {
dialog.showModal();

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/tabbrowser/content/tabs.js b/browser/components/tabbrowser/content/tabs.js
index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..691c5435cd27236f6374ab702be1ab66a0a26543 100644
index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..2885d896c4026278dfcb309f12230d6f86275ada 100644
--- a/browser/components/tabbrowser/content/tabs.js
+++ b/browser/components/tabbrowser/content/tabs.js
@@ -83,7 +83,7 @@
@@ -223,8 +223,15 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..691c5435cd27236f6374ab702be1ab66
let visibleTabsInGroup = child.tabs.filter(tab => tab.visible);
visibleTabsInGroup.forEach(tab => {
tab.elementIndex = elementIndex++;
@@ -1709,10 +1746,7 @@
@@ -1707,12 +1744,14 @@
focusableItems.push(...visibleTabsInGroup);
}
}
+ let glanceTab = child.querySelector("tab[zen-glance-tab]");
+ if (isTab(child) && glanceTab) {
+ glanceTab.elementIndex = elementIndex++;
+ focusableItems.push(glanceTab);
+ }
}
- this.#focusableItems = [
@@ -235,7 +242,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..691c5435cd27236f6374ab702be1ab66
return this.#focusableItems;
}
@@ -1720,6 +1754,7 @@
@@ -1720,6 +1759,7 @@
_invalidateCachedTabs() {
this.#allTabs = null;
this._invalidateCachedVisibleTabs();
@@ -243,7 +250,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..691c5435cd27236f6374ab702be1ab66
}
_invalidateCachedVisibleTabs() {
@@ -1734,8 +1769,8 @@
@@ -1734,8 +1774,8 @@
#isContainerVerticalPinnedGrid(tab) {
return (
this.verticalMode &&
@@ -254,7 +261,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..691c5435cd27236f6374ab702be1ab66
!this.expandOnHover
);
}
@@ -1751,7 +1786,7 @@
@@ -1751,7 +1791,7 @@
if (node == null) {
// We have a container for non-tab elements at the end of the scrollbox.
@@ -263,7 +270,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..691c5435cd27236f6374ab702be1ab66
}
node.before(tab);
@@ -1846,7 +1881,7 @@
@@ -1846,7 +1886,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.
@@ -272,7 +279,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..691c5435cd27236f6374ab702be1ab66
const newTab2 = this.newTabButton;
const newTabVertical = document.getElementById(
"vertical-tabs-newtab-button"
@@ -1941,10 +1976,12 @@
@@ -1941,10 +1981,12 @@
_handleTabSelect(aInstant) {
let selectedTab = this.selectedItem;
@@ -285,7 +292,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..691c5435cd27236f6374ab702be1ab66
selectedTab._notselectedsinceload = false;
}
@@ -2085,16 +2122,15 @@
@@ -2085,16 +2127,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.
@@ -308,7 +315,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..691c5435cd27236f6374ab702be1ab66
}
}
@@ -2102,9 +2138,7 @@
@@ -2102,9 +2143,7 @@
}
_resetVerticalPinnedTabs() {
@@ -319,7 +326,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..691c5435cd27236f6374ab702be1ab66
if (!verticalTabsContainer.children.length) {
return;
@@ -2117,7 +2151,7 @@
@@ -2117,7 +2156,7 @@
}
_positionPinnedTabs() {
@@ -328,7 +335,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..691c5435cd27236f6374ab702be1ab66
let numPinned = gBrowser.pinnedTabCount;
let absPositionHorizontalTabs =
this.overflowing && tabs.length > numPinned && numPinned > 0;
@@ -2127,7 +2161,7 @@
@@ -2127,7 +2166,7 @@
if (this.verticalMode) {
this._updateVerticalPinnedTabs();
@@ -337,7 +344,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..691c5435cd27236f6374ab702be1ab66
let layoutData = this._pinnedTabsLayoutCache;
let uiDensity = document.documentElement.getAttribute("uidensity");
if (!layoutData || layoutData.uiDensity != uiDensity) {
@@ -2191,7 +2225,7 @@
@@ -2191,7 +2230,7 @@
return;
}
@@ -346,7 +353,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..691c5435cd27236f6374ab702be1ab66
let directionX = screenX > dragData.animLastScreenX;
let directionY = screenY > dragData.animLastScreenY;
@@ -2199,7 +2233,7 @@
@@ -2199,7 +2238,7 @@
dragData.animLastScreenX = screenX;
let { width: tabWidth, height: tabHeight } =
@@ -355,7 +362,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..691c5435cd27236f6374ab702be1ab66
let shiftSizeX = tabWidth * movingTabs.length;
let shiftSizeY = tabHeight;
dragData.tabWidth = tabWidth;
@@ -2374,12 +2408,16 @@
@@ -2374,12 +2413,16 @@
this.#clearDragOverCreateGroupTimer();
@@ -377,7 +384,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..691c5435cd27236f6374ab702be1ab66
if (this.#rtlMode) {
tabs.reverse();
@@ -2393,7 +2431,7 @@
@@ -2393,7 +2436,7 @@
let size = this.verticalMode ? "height" : "width";
let translateAxis = this.verticalMode ? "translateY" : "translateX";
let scrollDirection = this.verticalMode ? "scrollTop" : "scrollLeft";
@@ -386,7 +393,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..691c5435cd27236f6374ab702be1ab66
let translateX = event.screenX - dragData.screenX;
let translateY = event.screenY - dragData.screenY;
@@ -2407,10 +2445,19 @@
@@ -2407,10 +2450,19 @@
let lastTab = tabs.at(-1);
let lastMovingTab = movingTabs.at(-1);
let firstMovingTab = movingTabs[0];
@@ -406,7 +413,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..691c5435cd27236f6374ab702be1ab66
let translate = screen - dragData[screenAxis];
if (!isPinned) {
translate +=
@@ -2431,6 +2478,9 @@
@@ -2431,6 +2483,9 @@
// Shift the `.tab-group-label-container` to shift the label element.
item = item.parentElement;
}
@@ -416,7 +423,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..691c5435cd27236f6374ab702be1ab66
item.style.transform = `${translateAxis}(${translate}px)`;
}
@@ -2568,6 +2618,9 @@
@@ -2568,6 +2623,9 @@
break;
}
let element = tabs[mid];
@@ -426,7 +433,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..691c5435cd27236f6374ab702be1ab66
let elementForSize = isTabGroupLabel(element)
? element.parentElement
: element;
@@ -2590,6 +2643,10 @@
@@ -2590,6 +2648,10 @@
if (!dropElement) {
dropElement = this.ariaFocusableItems[oldDropElementIndex];
}
@@ -437,7 +444,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..691c5435cd27236f6374ab702be1ab66
let newDropElementIndex = dropElement
? dropElement.elementIndex
: oldDropElementIndex;
@@ -2598,7 +2655,7 @@
@@ -2598,7 +2660,7 @@
let shouldCreateGroupOnDrop;
let dropBefore;
if (dropElement) {
@@ -446,7 +453,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..691c5435cd27236f6374ab702be1ab66
? dropElement.parentElement
: dropElement;
@@ -2660,12 +2717,12 @@
@@ -2660,12 +2722,12 @@
}
}
@@ -461,7 +468,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..691c5435cd27236f6374ab702be1ab66
dropElement != draggedTab &&
isTab(dropElement) &&
!dropElement?.group &&
@@ -2735,7 +2792,7 @@
@@ -2735,7 +2797,7 @@
// Shift background tabs to leave a gap where the dragged tab
// would currently be dropped.
for (let item of tabs) {
@@ -470,7 +477,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..691c5435cd27236f6374ab702be1ab66
continue;
}
@@ -2744,6 +2801,9 @@
@@ -2744,6 +2806,9 @@
if (isTabGroupLabel(item)) {
// Shift the `.tab-group-label-container` to shift the label element.
item = item.parentElement;
@@ -480,7 +487,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..691c5435cd27236f6374ab702be1ab66
}
item.style.transform = transform;
}
@@ -2796,8 +2856,9 @@
@@ -2796,8 +2861,9 @@
);
}
@@ -492,7 +499,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..691c5435cd27236f6374ab702be1ab66
return;
}
@@ -2809,6 +2870,12 @@
@@ -2809,6 +2875,12 @@
item = item.parentElement;
}
item.style.transform = "";
@@ -505,7 +512,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..691c5435cd27236f6374ab702be1ab66
item.removeAttribute("dragover-createGroup");
}
this.removeAttribute("movingtab-createGroup");
@@ -2855,7 +2922,7 @@
@@ -2855,7 +2927,7 @@
let postTransitionCleanup = () => {
movingTab._moveTogetherSelectedTabsData.animate = false;
};
@@ -514,7 +521,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..691c5435cd27236f6374ab702be1ab66
postTransitionCleanup();
} else {
let onTransitionEnd = transitionendEvent => {
@@ -3028,7 +3095,7 @@
@@ -3028,7 +3100,7 @@
}
_notifyBackgroundTab(aTab) {
@@ -523,7 +530,7 @@ index ef9c0389ec926e6bc01c0dc3b883beceaf1f7d43..691c5435cd27236f6374ab702be1ab66
return;
}
@@ -3154,6 +3221,9 @@
@@ -3154,6 +3226,9 @@
return null;
}
}

View File

@@ -470,10 +470,33 @@ groupbox h2 {
align-items: center;
}
.zenThemeMarketplaceItemHomepageButton {
width: 30px;
min-width: 0;
position: relative;
cursor: pointer;
&::before {
content: '';
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 18px;
height: 18px;
background-image: url('chrome://browser/skin/home.svg');
background-repeat: no-repeat;
background-size: cover;
fill: currentColor;
-moz-context-properties: fill, fill-opacity;
}
}
.zenThemeMarketplaceItemConfigureButton {
width: 30px;
min-width: 0;
position: relative;
cursor: pointer;
&::before {
content: '';

View File

@@ -1,3 +1,3 @@
# Temporal patches done to firefox
# Temporal patches done to Firefox
**IMPORTANT**: Once they start failing (on new firefox reelases), they should be removed as these patches are imported from future versions of firefox as termporary solutions while we wait.
**IMPORTANT**: Once they start failing (on new Firefox releases), they should be removed as these patches are imported from future versions of Firefox as temporary solutions while we wait.

View File

@@ -70,9 +70,12 @@ var gZenUIManager = {
} catch (error) {
console.error('Error updating layout breakout:', error);
}
setTimeout(() => {
ZenWorkspaces.updateTabsContainers();
}, 0);
if (!this._preventToolbarRebuild) {
setTimeout(() => {
ZenWorkspaces.updateTabsContainers();
}, 0);
}
delete this._preventToolbarRebuild;
},
get tabsWrapper() {

View File

@@ -104,7 +104,7 @@
}
#nav-bar {
/* For some reason, firefox adds a really small border to the top of the nav-bar */
/* For some reason, Firefox adds a really small border to the top of the nav-bar */
border-top: none !important;
}

View File

@@ -74,7 +74,7 @@ panel {
padding-inline-start: calc(16px + var(--uc-arrowpanel-menuicon-margin-inline));
}
/* firefox profile avatar in appmenu */
/* Firefox profile avatar in appmenu */
#appMenu-fxa-label2::before {
content: '';
display: -moz-box;

View File

@@ -19,7 +19,7 @@ const kZenMaxElementSeparation = 12;
* because we need a way to apply the accent color without having to worry about
* shadow roots not inheriting the accent color.
*
* note: It must be a firefox builtin page with access to the browser's configuration
* note: It must be a Firefox builtin page with access to the browser's configuration
* and services.
*/
var ZenThemeModifier = {

View File

@@ -394,7 +394,7 @@ class KeyShortcut {
}
key.setAttribute('group', this.#group);
// note to "mr. macos": We add the `zen-` prefix because firefox hasnt been built with the
// note to "mr. macos": We add the `zen-` prefix because Firefox hasnt been built with the
// shortcuts in mind, it will simply just override the shortcuts with whatever the default is.
// note that this l10n id is not used for actually translating the key's label, but rather to
// identify the default keybinds.

View File

@@ -586,12 +586,10 @@
}
onMediaMute() {
if (!this.mediaControlBar.hasAttribute('muted')) {
this._currentBrowser.mute();
this.mediaControlBar.setAttribute('muted', '');
} else {
this._currentBrowser.unmute();
this.mediaControlBar.removeAttribute('muted');
const tab = window.gBrowser.getTabForBrowser(this._currentBrowser);
if (tab) {
tab.toggleMuteAudio();
this.updateMuteState();
}
}
@@ -639,7 +637,7 @@
updateMuteState() {
if (!this._currentBrowser) return;
this.mediaControlBar.toggleAttribute('muted', this._currentBrowser._audioMuted);
this.mediaControlBar.toggleAttribute('muted', this._currentBrowser.audioMuted);
}
updatePipButton() {

View File

@@ -380,7 +380,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
}
getCurrentEssentialsContainer() {
const currentWorkspace = this.activeWorkspace;
const currentWorkspace = this.getActiveWorkspaceFromCache();
return this.getEssentialsSection(currentWorkspace?.containerTabId);
}
@@ -956,7 +956,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
}
handleContextMenuCommand(event) {
const target = event.target.closest('toolbarbutton');
const target = event.target.closest('menuitem');
if (!target) {
return;
}
@@ -1974,7 +1974,8 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
const newTransform = `translateX(${offset}%)`;
if (shouldAnimate) {
if (element.classList.contains('zen-workspace-pinned-tabs-section') && this.containerSpecificEssentials) {
await this.updateTabsContainers(element, true);
// Note: Do not call with await on purpose, for better timing on animations
this.updateTabsContainers(element, true);
}
element.removeAttribute('hidden');
animations.push(
@@ -2103,6 +2104,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
}
}
if (shouldAnimate) {
gZenUIManager._preventToolbarRebuild = true;
gZenUIManager.updateTabsToolbar();
}
await Promise.all(animations);
@@ -2297,7 +2299,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
}
async updateTabsContainers(target = undefined, forAnimation = false) {
if (target && !(target instanceof HTMLElement)) {
if (target && !target.parentNode) {
target = null;
}
await this.onPinnedTabsResize([{ target: target ?? this.pinnedTabsContainer }], forAnimation);