mirror of
https://github.com/zen-browser/desktop.git
synced 2026-04-25 08:44:11 +00:00
chore: Pre-release changes, b=(no-bug), c=common, mods, tabs, workspaces
This commit is contained in:
2
l10n
2
l10n
Submodule l10n updated: e51bc808c4...14c9e3a9f8
@@ -1,5 +1,5 @@
|
||||
diff --git a/browser/components/urlbar/UrlbarInput.sys.mjs b/browser/components/urlbar/UrlbarInput.sys.mjs
|
||||
index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..2de9f51784a92442da84ead54312e879c1da127b 100644
|
||||
index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..22c2a5040913b7518ea85ed781c9cd499e386a78 100644
|
||||
--- a/browser/components/urlbar/UrlbarInput.sys.mjs
|
||||
+++ b/browser/components/urlbar/UrlbarInput.sys.mjs
|
||||
@@ -68,6 +68,13 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
||||
@@ -76,19 +76,21 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..2de9f51784a92442da84ead54312e879
|
||||
startLayoutExtend() {
|
||||
if (!this.#allowBreakout || this.hasAttribute("breakout-extend")) {
|
||||
// Do not expand if the Urlbar does not support being expanded or it is
|
||||
@@ -2147,6 +2173,11 @@ export class UrlbarInput {
|
||||
@@ -2147,6 +2173,13 @@ export class UrlbarInput {
|
||||
|
||||
this.setAttribute("breakout-extend", "true");
|
||||
|
||||
+ if (lazy.ZEN_URLBAR_BEHAVIOR == 'float' || (lazy.ZEN_URLBAR_BEHAVIOR == 'floating-on-type' && !this.focusedViaMousedown)) {
|
||||
+ this.setAttribute("zen-floating-urlbar", "true");
|
||||
+ // Divide the window by 2 and subtract the urlbar height to get the top
|
||||
+ this.textbox.style.setProperty("--zen-urlbar-top", `${(this.window.innerHeight / 6)}px`);
|
||||
+ } else {
|
||||
+ this.removeAttribute("zen-floating-urlbar");
|
||||
+ }
|
||||
// Enable the animation only after the first extend call to ensure it
|
||||
// doesn't run when opening a new window.
|
||||
if (!this.hasAttribute("breakout-extend-animate")) {
|
||||
@@ -2166,6 +2197,19 @@ export class UrlbarInput {
|
||||
@@ -2166,6 +2199,19 @@ export class UrlbarInput {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -108,7 +110,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..2de9f51784a92442da84ead54312e879
|
||||
this.removeAttribute("breakout-extend");
|
||||
this.#updateTextboxPosition();
|
||||
}
|
||||
@@ -2485,7 +2529,7 @@ export class UrlbarInput {
|
||||
@@ -2485,7 +2531,7 @@ export class UrlbarInput {
|
||||
|
||||
this.textbox.parentNode.style.setProperty(
|
||||
"--urlbar-container-height",
|
||||
@@ -117,7 +119,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..2de9f51784a92442da84ead54312e879
|
||||
);
|
||||
this.textbox.style.setProperty(
|
||||
"--urlbar-height",
|
||||
@@ -2998,7 +3042,7 @@ export class UrlbarInput {
|
||||
@@ -2998,7 +3044,7 @@ export class UrlbarInput {
|
||||
*/
|
||||
_trimValue(val) {
|
||||
let trimmedValue = lazy.UrlbarPrefs.get("trimURLs")
|
||||
@@ -126,7 +128,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..2de9f51784a92442da84ead54312e879
|
||||
: val;
|
||||
// Only trim value if the directionality doesn't change to RTL and we're not
|
||||
// showing a strikeout https protocol.
|
||||
@@ -3368,6 +3412,10 @@ export class UrlbarInput {
|
||||
@@ -3368,6 +3414,10 @@ export class UrlbarInput {
|
||||
}
|
||||
reuseEmpty = true;
|
||||
}
|
||||
@@ -137,7 +139,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..2de9f51784a92442da84ead54312e879
|
||||
if (
|
||||
where == "tab" &&
|
||||
reuseEmpty &&
|
||||
@@ -3375,6 +3423,9 @@ export class UrlbarInput {
|
||||
@@ -3375,6 +3425,9 @@ export class UrlbarInput {
|
||||
) {
|
||||
where = "current";
|
||||
}
|
||||
@@ -147,7 +149,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..2de9f51784a92442da84ead54312e879
|
||||
return where;
|
||||
}
|
||||
|
||||
@@ -3632,6 +3683,7 @@ export class UrlbarInput {
|
||||
@@ -3632,6 +3685,7 @@ export class UrlbarInput {
|
||||
this.setResultForCurrentValue(null);
|
||||
this.handleCommand();
|
||||
this.controller.clearLastQueryContextCache();
|
||||
@@ -155,7 +157,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..2de9f51784a92442da84ead54312e879
|
||||
|
||||
this._suppressStartQuery = false;
|
||||
});
|
||||
@@ -3639,7 +3691,6 @@ export class UrlbarInput {
|
||||
@@ -3639,7 +3693,6 @@ export class UrlbarInput {
|
||||
contextMenu.addEventListener("popupshowing", () => {
|
||||
// Close the results pane when the input field contextual menu is open,
|
||||
// because paste and go doesn't want a result selection.
|
||||
@@ -163,7 +165,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..2de9f51784a92442da84ead54312e879
|
||||
|
||||
let controller =
|
||||
this.document.commandDispatcher.getControllerForCommand("cmd_paste");
|
||||
@@ -4053,6 +4104,11 @@ export class UrlbarInput {
|
||||
@@ -4053,6 +4106,11 @@ export class UrlbarInput {
|
||||
}
|
||||
|
||||
_on_click(event) {
|
||||
@@ -175,7 +177,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..2de9f51784a92442da84ead54312e879
|
||||
if (
|
||||
event.target == this.inputField ||
|
||||
event.target == this._inputContainer ||
|
||||
@@ -4124,7 +4180,7 @@ export class UrlbarInput {
|
||||
@@ -4124,7 +4182,7 @@ export class UrlbarInput {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,7 +186,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..2de9f51784a92442da84ead54312e879
|
||||
this.view.autoOpen({ event });
|
||||
} else {
|
||||
if (this._untrimOnFocusAfterKeydown) {
|
||||
@@ -4164,9 +4220,12 @@ export class UrlbarInput {
|
||||
@@ -4164,9 +4222,12 @@ export class UrlbarInput {
|
||||
}
|
||||
|
||||
_on_mousedown(event) {
|
||||
@@ -198,7 +200,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..2de9f51784a92442da84ead54312e879
|
||||
|
||||
if (
|
||||
event.target != this.inputField &&
|
||||
@@ -4176,8 +4235,8 @@ export class UrlbarInput {
|
||||
@@ -4176,8 +4237,8 @@ export class UrlbarInput {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -209,7 +211,7 @@ index 4b69136aa31bfef3a1d3b57ad0c75fe07fa26be0..2de9f51784a92442da84ead54312e879
|
||||
|
||||
// Keep the focus status, since the attribute may be changed
|
||||
// upon calling this.focus().
|
||||
@@ -4218,7 +4277,7 @@ export class UrlbarInput {
|
||||
@@ -4218,7 +4279,7 @@ export class UrlbarInput {
|
||||
}
|
||||
// Don't close the view when clicking on a tab; we may want to keep the
|
||||
// view open on tab switch, and the TabSelect event arrived earlier.
|
||||
|
||||
22
src/browser/installer/windows/nsis/defines-nsi-in.patch
Normal file
22
src/browser/installer/windows/nsis/defines-nsi-in.patch
Normal file
@@ -0,0 +1,22 @@
|
||||
diff --git a/browser/installer/windows/nsis/defines.nsi.in b/browser/installer/windows/nsis/defines.nsi.in
|
||||
index eb9e403c36510bfda09eb84b8a35dff731279f5d..939d34dff255122947bf3eeabc9087685f101568 100644
|
||||
--- a/browser/installer/windows/nsis/defines.nsi.in
|
||||
+++ b/browser/installer/windows/nsis/defines.nsi.in
|
||||
@@ -90,7 +90,7 @@
|
||||
!define BETA_UPDATE_CHANNEL
|
||||
!endif
|
||||
|
||||
-!define BaseURLStubPing "http://download-stats.mozilla.org/stub"
|
||||
+!define BaseURLStubPing ""
|
||||
|
||||
# ARCH is used when it is necessary to differentiate the x64 registry keys from
|
||||
# the x86 registry keys (e.g. the uninstall registry key).
|
||||
@@ -148,7 +148,7 @@ VIAddVersionKey "ProductVersion" "${AppVersion}"
|
||||
!define APPROXIMATE_REQUIRED_SPACE_MB "145"
|
||||
|
||||
# Constants for parts of the telemetry submission URL
|
||||
-!define TELEMETRY_BASE_URL https://incoming.telemetry.mozilla.org/submit
|
||||
+!define TELEMETRY_BASE_URL
|
||||
!define TELEMETRY_NAMESPACE firefox-installer
|
||||
!define TELEMETRY_INSTALL_PING_VERSION 1
|
||||
!define TELEMETRY_INSTALL_PING_DOCTYPE install
|
||||
@@ -1,20 +1,20 @@
|
||||
diff --git a/browser/installer/windows/nsis/installer.nsi b/browser/installer/windows/nsis/installer.nsi
|
||||
index 491bcbbd8430410fa930e7b52491ea62f2c48bbc..905f46d711f94398c9b1c20d6387cd76fcdf4aa9 100755
|
||||
index 491bcbbd8430410fa930e7b52491ea62f2c48bbc..42d960f4adb4837009e0106a137c14fcbd7a55f9 100755
|
||||
--- a/browser/installer/windows/nsis/installer.nsi
|
||||
+++ b/browser/installer/windows/nsis/installer.nsi
|
||||
@@ -836,9 +836,6 @@ Section "-InstallEndCleanup"
|
||||
|
||||
@@ -837,7 +837,7 @@ Section "-InstallEndCleanup"
|
||||
; When we're using the GUI, .onGUIEnd sends the ping, but of course that isn't
|
||||
; invoked when we're running silently.
|
||||
- ${If} ${Silent}
|
||||
${If} ${Silent}
|
||||
- Call SendPing
|
||||
- ${EndIf}
|
||||
+ ; Call SendPing
|
||||
${EndIf}
|
||||
SectionEnd
|
||||
|
||||
################################################################################
|
||||
@@ -1965,5 +1962,4 @@ FunctionEnd
|
||||
@@ -1965,5 +1965,5 @@ FunctionEnd
|
||||
|
||||
Function .onGUIEnd
|
||||
${OnEndCommon}
|
||||
- Call SendPing
|
||||
+ ; Call SendPing
|
||||
FunctionEnd
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
diff --git a/browser/installer/windows/nsis/uninstaller.nsi b/browser/installer/windows/nsis/uninstaller.nsi
|
||||
old mode 100755
|
||||
new mode 100644
|
||||
index 559c8b46ee06bc42c91da49b5d9e397fe8ff6126..2920621824af171588b1cd38ac8b2329fbdb6e25
|
||||
index 559c8b46ee06bc42c91da49b5d9e397fe8ff6126..62094a5d98712a41a607ba01ca2adfa1e4f51ccd
|
||||
--- a/browser/installer/windows/nsis/uninstaller.nsi
|
||||
+++ b/browser/installer/windows/nsis/uninstaller.nsi
|
||||
@@ -507,6 +507,7 @@ Section "Uninstall"
|
||||
@@ -12,16 +12,3 @@ index 559c8b46ee06bc42c91da49b5d9e397fe8ff6126..2920621824af171588b1cd38ac8b2329
|
||||
|
||||
${un.RegCleanFileHandler} ".pdf" "FirefoxPDF-$AppUserModelID"
|
||||
|
||||
@@ -980,12 +981,6 @@ FunctionEnd
|
||||
|
||||
Function un.onUninstSuccess
|
||||
; Send a ping at un.onGUIEnd, to avoid freezing the GUI.
|
||||
- StrCpy $ShouldSendPing "1"
|
||||
-
|
||||
- ${If} ${Silent}
|
||||
- ; If this is a silent uninstall then un.onGUIEnd doesn't run, so do it now.
|
||||
- Call un.SendUninstallPing
|
||||
- ${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
Function un.preFinish
|
||||
|
||||
13
src/browser/locales/en-US/installer/custom-properties.patch
Normal file
13
src/browser/locales/en-US/installer/custom-properties.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
diff --git a/browser/locales/en-US/installer/custom.properties b/browser/locales/en-US/installer/custom.properties
|
||||
index a9dc6fb90caa50a9ba9ec63a6cd90b4d8dcc2bc0..48d11c0c5a3b926d2d29c30d1ca8630941514210 100644
|
||||
--- a/browser/locales/en-US/installer/custom.properties
|
||||
+++ b/browser/locales/en-US/installer/custom.properties
|
||||
@@ -77,7 +77,7 @@ STATUS_INSTALL_LANG=Installing Language Files (${AB_CD})…
|
||||
STATUS_UNINSTALL_MAIN=Uninstalling $BrandShortName…
|
||||
STATUS_CLEANUP=A Little Housekeeping…
|
||||
|
||||
-UN_SURVEY_CHECKBOX_LABEL=Tell Mozilla why you uninstalled $BrandShortName
|
||||
+UN_SURVEY_CHECKBOX_LABEL=Tell Zen´s Team why you uninstalled $BrandShortName
|
||||
|
||||
# _DESC strings support approximately 65 characters per line.
|
||||
# One line
|
||||
@@ -43,28 +43,6 @@ var gZenUIManager = {
|
||||
},
|
||||
|
||||
updateTabsToolbar() {
|
||||
// Set tabs max-height to the "toolbar-items" height
|
||||
const tabs = this.tabsWrapper;
|
||||
// Remove tabs so we can accurately calculate the height
|
||||
// without them affecting the height of the toolbar
|
||||
for (const tab of gBrowser.tabs) {
|
||||
if (tab.hasAttribute('zen-essential')) {
|
||||
continue;
|
||||
}
|
||||
tab.style.maxHeight = '0px';
|
||||
}
|
||||
tabs.style.flex = '1';
|
||||
tabs.style.removeProperty('max-height');
|
||||
const toolbarRect = tabs.getBoundingClientRect();
|
||||
let height = toolbarRect.height;
|
||||
for (const tab of gBrowser.tabs) {
|
||||
if (tab.hasAttribute('zen-essential')) {
|
||||
continue;
|
||||
}
|
||||
tab.style.removeProperty('max-height');
|
||||
}
|
||||
tabs.style.removeProperty('flex');
|
||||
tabs.style.maxHeight = height + 'px';
|
||||
gZenVerticalTabsManager.actualWindowButtons.removeAttribute('zen-has-hover');
|
||||
gZenVerticalTabsManager.recalculateURLBarHeight();
|
||||
if (!this._preventToolbarRebuild) {
|
||||
@@ -625,7 +603,7 @@ var gZenVerticalTabsManager = {
|
||||
document.getElementById('urlbar').removeAttribute('--urlbar-height');
|
||||
if (!this._hasSetSingleToolbar) {
|
||||
document.getElementById('urlbar').style.setProperty('--urlbar-height', '32px');
|
||||
} else if (gURLBar.getAttribute('breakout') !== 'true') {
|
||||
} else if (gURLBar.getAttribute('breakout-extend') !== 'true') {
|
||||
try {
|
||||
gURLBar.zenUpdateLayoutBreakout();
|
||||
} catch (e) {
|
||||
|
||||
@@ -188,8 +188,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
:root[zen-window-buttons-reversed='true'][zen-right-side='true'] .titlebar-buttonbox-container {
|
||||
margin-inline-start: calc(var(--zen-element-separation) - 3px);
|
||||
@media (-moz-platform: macos) {
|
||||
:root[zen-window-buttons-reversed='true'][zen-right-side='true'] .titlebar-buttonbox-container {
|
||||
margin-inline-start: max(calc(var(--zen-element-separation) - 3px), 4px);
|
||||
}
|
||||
}
|
||||
|
||||
.zen-split-view-splitter[orient='vertical'],
|
||||
|
||||
@@ -454,7 +454,7 @@ button.popup-notification-dropmarker {
|
||||
font-size: 1.5em !important;
|
||||
width: min(90%, 60rem) !important;
|
||||
}
|
||||
top: 20svh !important;
|
||||
top: var(--zen-urlbar-top) !important;
|
||||
transform: translateX(-50%);
|
||||
left: 50% !important;
|
||||
|
||||
@@ -542,6 +542,7 @@ button.popup-notification-dropmarker {
|
||||
|
||||
& * {
|
||||
color: white !important;
|
||||
fill: black !important;
|
||||
}
|
||||
|
||||
& .urlbarView-favicon {
|
||||
|
||||
@@ -275,9 +275,6 @@
|
||||
sequence.transform.push(`translate(calc(${x}px - 50%), calc(${y}px - 50%)) rotate(${rotation}deg) scale(${scale})`);
|
||||
}
|
||||
|
||||
// Last opacity should be 0
|
||||
sequence.opacity[steps] = 0;
|
||||
|
||||
return sequence;
|
||||
}
|
||||
|
||||
|
||||
@@ -75,24 +75,28 @@ export class ZenThemeMarketplaceParent extends JSWindowActorParent {
|
||||
console.info('ZenThemeMarketplaceParent: Checking for theme updates');
|
||||
|
||||
let updates = [];
|
||||
this._themes = null;
|
||||
this._themes = {};
|
||||
|
||||
for (const theme of Object.values(await this.getThemes())) {
|
||||
const themeInfo = await this.sendQuery('ZenThemeMarketplace:GetThemeInfo', { themeId: theme.id });
|
||||
try {
|
||||
const themeInfo = await this.sendQuery('ZenThemeMarketplace:GetThemeInfo', { themeId: theme.id });
|
||||
|
||||
if (!themeInfo) {
|
||||
continue;
|
||||
}
|
||||
if (!themeInfo) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!this.compareVersions(themeInfo.version, theme.version || '0.0.0') && themeInfo.version != theme.version) {
|
||||
console.info('ZenThemeMarketplaceParent: Theme update found', theme.id, theme.version, themeInfo.version);
|
||||
if (!this.compareVersions(themeInfo.version, theme.version || '0.0.0') && themeInfo.version != theme.version) {
|
||||
console.info('ZenThemeMarketplaceParent: Theme update found', theme.id, theme.version, themeInfo.version);
|
||||
|
||||
themeInfo.enabled = theme.enabled;
|
||||
updates.push(themeInfo);
|
||||
themeInfo.enabled = theme.enabled;
|
||||
updates.push(themeInfo);
|
||||
|
||||
await this.removeTheme(theme.id, false);
|
||||
await this.removeTheme(theme.id, false);
|
||||
|
||||
this._themes[themeInfo.id] = themeInfo;
|
||||
this._themes[themeInfo.id] = themeInfo;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('ZenThemeMarketplaceParent: Error checking for theme updates', e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,16 +183,18 @@ export class ZenThemeMarketplaceParent extends JSWindowActorParent {
|
||||
const themeIds = Object.keys(themes);
|
||||
|
||||
for (const themeId of themeIds) {
|
||||
const theme = themes[themeId];
|
||||
try {
|
||||
const theme = themes[themeId];
|
||||
if (!theme) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!theme) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const themePath = PathUtils.join(this.themesRootPath, themeId);
|
||||
|
||||
if (!(await IOUtils.exists(themePath))) {
|
||||
await this.installTheme(theme);
|
||||
const themePath = PathUtils.join(this.themesRootPath, themeId);
|
||||
if (!(await IOUtils.exists(themePath))) {
|
||||
await this.installTheme(theme);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('ZenThemeMarketplaceParent: Error checking for theme changes', e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1259,7 +1259,10 @@
|
||||
grid-template-columns: repeat(auto-fit, minmax(max(30%, 48px), auto));
|
||||
}
|
||||
&[data-hack-type='2'] {
|
||||
grid-template-columns: repeat(auto-fit, minmax(max(23.7%, 48px), 1fr) minmax(max(23.7%, 48px), 1fr));
|
||||
grid-template-columns: repeat(auto-fit, minmax(max(23%, 48px), 1fr) minmax(max(23%, 48px), 1fr));
|
||||
}
|
||||
&[data-hack-type='3'] {
|
||||
grid-template-columns: repeat(auto-fit, minmax(max(25%, 48px), 1fr));
|
||||
}
|
||||
scrollbar-width: thin;
|
||||
min-width: calc(100% + var(--zen-toolbox-padding) * 2);
|
||||
@@ -1456,5 +1459,6 @@
|
||||
&[hidden='true'] {
|
||||
visibility: hidden;
|
||||
pointer-events: none;
|
||||
position: fixed; /* Fix position to prevent scrolling */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -559,6 +559,15 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
// Use MozSwipeGesture instead of MozSwipeGestureEnd because MozSwipeGestureEnd is fired after animation ends,
|
||||
// while MozSwipeGesture is fired immediately after swipe ends.
|
||||
element.addEventListener('MozSwipeGesture', this._handleSwipeEnd.bind(this), true);
|
||||
|
||||
element.addEventListener(
|
||||
'MozSwipeGestureEnd',
|
||||
(event) => {
|
||||
gZenUIManager.tabsWrapper.style.removeProperty('scrollbar-width');
|
||||
this.updateTabsContainers();
|
||||
},
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
_handleSwipeMayStart(event) {
|
||||
@@ -578,6 +587,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
_handleSwipeStart(event) {
|
||||
if (!this.workspaceEnabled) return;
|
||||
|
||||
gZenUIManager.tabsWrapper.style.scrollbarWidth = 'none';
|
||||
gZenUIManager.tabsWrapper.scrollTop = 0;
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
this._swipeState = {
|
||||
@@ -752,6 +764,8 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
window.addEventListener('TabClose', tabUpdateListener);
|
||||
window.addEventListener('TabAddedToEssentials', tabUpdateListener);
|
||||
window.addEventListener('TabRemovedFromEssentials', tabUpdateListener);
|
||||
window.addEventListener('TabPinned', tabUpdateListener);
|
||||
window.addEventListener('TabUnpinned', tabUpdateListener);
|
||||
let activeWorkspace = await this.getActiveWorkspace();
|
||||
this.activeWorkspace = activeWorkspace?.uuid;
|
||||
try {
|
||||
@@ -1790,17 +1804,16 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
this._animateTabs(this.getActiveWorkspaceFromCache(), true);
|
||||
}
|
||||
|
||||
async _performWorkspaceChange(window, { onInit = false, alwaysChange = false, whileScrolling = false } = {}) {
|
||||
async _performWorkspaceChange(workspace, { onInit = false, alwaysChange = false, whileScrolling = false } = {}) {
|
||||
const previousWorkspace = await this.getActiveWorkspace();
|
||||
alwaysChange = alwaysChange || onInit;
|
||||
|
||||
this.activeWorkspace = window.uuid;
|
||||
if (previousWorkspace && previousWorkspace.uuid === window.uuid && !alwaysChange) {
|
||||
this.activeWorkspace = workspace.uuid;
|
||||
if (previousWorkspace && previousWorkspace.uuid === workspace.uuid && !alwaysChange) {
|
||||
this._cancelSwipeAnimation();
|
||||
return;
|
||||
}
|
||||
|
||||
const containerId = window.containerTabId?.toString();
|
||||
const workspaces = await this._workspaces();
|
||||
|
||||
// Refresh tab cache
|
||||
@@ -1808,7 +1821,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
gBrowser.tabContainer.verticalPinnedTabsContainer =
|
||||
this.pinnedTabsContainer || gBrowser.tabContainer.verticalPinnedTabsContainer;
|
||||
// Move empty tab to the new workspace
|
||||
this._moveEmptyTabToWorkspace(window.uuid);
|
||||
this._moveEmptyTabToWorkspace(workspace.uuid);
|
||||
|
||||
this.tabContainer._invalidateCachedTabs();
|
||||
if (!whileScrolling) {
|
||||
@@ -1817,12 +1830,12 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
|
||||
// Second pass: Handle tab selection
|
||||
this.tabContainer._invalidateCachedTabs();
|
||||
const tabToSelect = await this._handleTabSelection(window, onInit, previousWorkspace.uuid);
|
||||
const tabToSelect = await this._handleTabSelection(workspace, onInit, previousWorkspace.uuid);
|
||||
gBrowser.warmupTab(tabToSelect);
|
||||
|
||||
// Update UI and state
|
||||
const previousWorkspaceIndex = workspaces.workspaces.findIndex((w) => w.uuid === previousWorkspace.uuid);
|
||||
await this._updateWorkspaceState(window, onInit, tabToSelect, { previousWorkspaceIndex, previousWorkspace });
|
||||
await this._updateWorkspaceState(workspace, onInit, tabToSelect, { previousWorkspaceIndex, previousWorkspace });
|
||||
}
|
||||
|
||||
_moveEmptyTabToWorkspace(workspaceUuid) {
|
||||
@@ -1848,7 +1861,14 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
}
|
||||
}
|
||||
|
||||
_updateMarginTopPinnedTabs(arrowscrollbox, pinnedContainer, essentialContainer, workspaceIndicator, forAnimation = false) {
|
||||
_updateMarginTopPinnedTabs(
|
||||
arrowscrollbox,
|
||||
pinnedContainer,
|
||||
essentialContainer,
|
||||
workspaceIndicator,
|
||||
forAnimation = false,
|
||||
animateContainer = false
|
||||
) {
|
||||
if (arrowscrollbox && !(this._inChangingWorkspace && !forAnimation && !this._alwaysAnimateMarginTop)) {
|
||||
delete this._alwaysAnimateMarginTop;
|
||||
const essentialsHeight = essentialContainer.getBoundingClientRect().height;
|
||||
@@ -1865,8 +1885,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
document.getElementById('zen-tabs-wrapper').style.marginTop = '';
|
||||
}
|
||||
}
|
||||
if (!forAnimation && !this._inChangingWorkspace) {
|
||||
// TODO:
|
||||
if (!forAnimation && animateContainer) {
|
||||
gZenUIManager.motion.animate(
|
||||
arrowscrollbox,
|
||||
{
|
||||
@@ -1885,11 +1904,22 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
}
|
||||
|
||||
async _organizeWorkspaceStripLocations(workspace, justMove = false, offsetPixels = 0) {
|
||||
this._organizingWorkspaceStrip = true;
|
||||
const workspaces = await this._workspaces();
|
||||
let workspaceIndex = workspaces.workspaces.findIndex((w) => w.uuid === workspace.uuid);
|
||||
if (!justMove) {
|
||||
this._fixIndicatorsNames(workspaces);
|
||||
}
|
||||
const otherContainersEssentials = document.querySelectorAll(`#zen-essentials-wrapper .zen-workspace-tabs-section`);
|
||||
const workspaceContextId = workspace.containerTabId;
|
||||
const nextWorkspaceContextId = workspaces.workspaces[workspaceIndex + (offsetPixels > 0 ? -1 : 1)]?.containerTabId;
|
||||
if (this.containerSpecificEssentials && justMove) {
|
||||
const waitForContainers = [];
|
||||
for (const element of document.querySelectorAll('.zen-workspace-tabs-section.zen-workspace-pinned-tabs-section')) {
|
||||
waitForContainers.push(this.updateTabsContainers(element, true));
|
||||
}
|
||||
await Promise.all(waitForContainers);
|
||||
}
|
||||
for (const otherWorkspace of workspaces.workspaces) {
|
||||
const selector = `.zen-workspace-tabs-section[zen-workspace-id="${otherWorkspace.uuid}"]`;
|
||||
const newTransform = -(workspaceIndex - workspaces.workspaces.indexOf(otherWorkspace)) * 100;
|
||||
@@ -1903,17 +1933,6 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
}
|
||||
}
|
||||
// Hide other essentials with different containerTabId
|
||||
const otherContainersEssentials = document.querySelectorAll(`#zen-essentials-wrapper .zen-workspace-tabs-section`);
|
||||
const workspaceContextId = workspace.containerTabId;
|
||||
const nextWorkspaceContextId = workspaces.workspaces[workspaceIndex + (offsetPixels > 0 ? -1 : 1)]?.containerTabId;
|
||||
if (nextWorkspaceContextId !== workspaceContextId && offsetPixels && this.containerSpecificEssentials) {
|
||||
document.getElementById('zen-tabs-wrapper').style.marginTop = '';
|
||||
const waitForContainers = [];
|
||||
for (const element of document.querySelectorAll('.zen-workspace-tabs-section.zen-workspace-pinned-tabs-section')) {
|
||||
waitForContainers.push(this.updateTabsContainers(element, true));
|
||||
}
|
||||
await Promise.all(waitForContainers);
|
||||
}
|
||||
for (const container of otherContainersEssentials) {
|
||||
// Get the next workspace contextId, if it's the same, dont apply offsetPixels
|
||||
// if it's not we do apply it
|
||||
@@ -1922,7 +1941,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
} else {
|
||||
container.removeAttribute('hidden');
|
||||
}
|
||||
if (nextWorkspaceContextId !== workspaceContextId && offsetPixels) {
|
||||
if (nextWorkspaceContextId !== workspaceContextId && offsetPixels && this.containerSpecificEssentials) {
|
||||
container.removeAttribute('hidden');
|
||||
// Animate from the currently selected workspace
|
||||
if (container.getAttribute('container') == workspaceContextId) {
|
||||
@@ -1933,6 +1952,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
}
|
||||
}
|
||||
}
|
||||
delete this._organizingWorkspaceStrip;
|
||||
}
|
||||
|
||||
updateWorkspaceIndicator(currentWorkspace, workspaceIndicator) {
|
||||
@@ -1995,16 +2015,14 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
essentialsContainer.parentNode.appendChild(essentialsClone);
|
||||
}
|
||||
}
|
||||
if (shouldAnimate) {
|
||||
if (shouldAnimate && this.containerSpecificEssentials) {
|
||||
document.getElementById('zen-tabs-wrapper').style.marginTop = '';
|
||||
const waitForContainers = [];
|
||||
for (const element of document.querySelectorAll('.zen-workspace-tabs-section.zen-workspace-pinned-tabs-section')) {
|
||||
waitForContainers.push(this.updateTabsContainers(element, true));
|
||||
}
|
||||
await Promise.all(waitForContainers);
|
||||
if (shouldAnimate && this.containerSpecificEssentials) {
|
||||
const waitForContainers = [];
|
||||
for (const element of document.querySelectorAll('.zen-workspace-tabs-section.zen-workspace-pinned-tabs-section')) {
|
||||
waitForContainers.push(this.updateTabsContainers(element, true));
|
||||
}
|
||||
await Promise.all(waitForContainers);
|
||||
}
|
||||
|
||||
for (const element of document.querySelectorAll('.zen-workspace-tabs-section')) {
|
||||
if (element.classList.contains('zen-essentials-container')) {
|
||||
continue;
|
||||
@@ -2191,13 +2209,13 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
return !(aTab?.hasAttribute('zen-essential') || (aTab?.pinned && aTab?.hasAttribute('pending')));
|
||||
}
|
||||
|
||||
async _handleTabSelection(window, onInit, previousWorkspaceId) {
|
||||
async _handleTabSelection(workspace, onInit, previousWorkspaceId) {
|
||||
const currentSelectedTab = gBrowser.selectedTab;
|
||||
const oldWorkspaceId = previousWorkspaceId;
|
||||
const lastSelectedTab = this._lastSelectedWorkspaceTabs[window.uuid];
|
||||
const lastSelectedTab = this._lastSelectedWorkspaceTabs[workspace.uuid];
|
||||
|
||||
// Save current tab as last selected for old workspace if it shouldn't be visible in new workspace
|
||||
if (oldWorkspaceId && oldWorkspaceId !== window.uuid) {
|
||||
if (oldWorkspaceId && oldWorkspaceId !== workspace.uuid) {
|
||||
this._lastSelectedWorkspaceTabs[oldWorkspaceId] = gZenGlanceManager.getTabOrGlanceParent(currentSelectedTab);
|
||||
}
|
||||
|
||||
@@ -2249,13 +2267,13 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
|
||||
gZenThemePicker.onWorkspaceChange(workspace);
|
||||
|
||||
document.getElementById('zen-tabs-wrapper').style.scrollbarWidth = 'none';
|
||||
gZenUIManager.tabsWrapper.scrollbarWidth = 'none';
|
||||
await this._animateTabs(workspace, !onInit && !this._animatingChange, tabToSelect, {
|
||||
previousWorkspaceIndex,
|
||||
previousWorkspace,
|
||||
});
|
||||
await this._organizeWorkspaceStripLocations(workspace, true);
|
||||
document.getElementById('zen-tabs-wrapper').style.scrollbarWidth = '';
|
||||
gZenUIManager.tabsWrapper.style.scrollbarWidth = '';
|
||||
|
||||
// Notify listeners
|
||||
if (this._changeListeners?.length) {
|
||||
@@ -2274,12 +2292,11 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
this._fixCtrlTabBehavior();
|
||||
|
||||
// Bug: When updating from previous versions, we used to hide the tabs not used in the new workspace
|
||||
// we now need to show them again
|
||||
// we now need to show them again.
|
||||
// TODO: Remove this on future versions
|
||||
if (onInit) {
|
||||
for (const tab of this.allStoredTabs) {
|
||||
if (!tab.hasAttribute('zen-essential')) {
|
||||
gBrowser.showTab(tab);
|
||||
}
|
||||
gBrowser.showTab(tab);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2368,7 +2385,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
if (target && !target.parentNode) {
|
||||
target = null;
|
||||
}
|
||||
await this.onPinnedTabsResize([{ target: target ?? this.pinnedTabsContainer }], forAnimation);
|
||||
// Only animate if it's from an event
|
||||
const animateContainer = target && target instanceof EventTarget;
|
||||
await this.onPinnedTabsResize([{ target: target ?? this.pinnedTabsContainer }], forAnimation, animateContainer);
|
||||
}
|
||||
|
||||
updateShouldHideSeparator(arrowScrollbox, pinnedContainer) {
|
||||
@@ -2385,8 +2404,8 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
}
|
||||
}
|
||||
|
||||
async onPinnedTabsResize(entries, forAnimation = false) {
|
||||
if (!this._hasInitializedTabsStrip) {
|
||||
async onPinnedTabsResize(entries, forAnimation = false, animateContainer = false) {
|
||||
if (!this._hasInitializedTabsStrip || (this._organizingWorkspaceStrip && !forAnimation)) {
|
||||
return;
|
||||
}
|
||||
// forAnimation may be of type "ResizeObserver" if it's not a boolean, just ignore it
|
||||
@@ -2423,15 +2442,24 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
let essentialHackType = 0;
|
||||
if (essentialNumChildren === 6 || essentialNumChildren === 9) {
|
||||
essentialHackType = 1;
|
||||
} else if (essentialNumChildren % 2 === 0) {
|
||||
} else if (essentialNumChildren % 2 === 0 && essentialNumChildren < 8) {
|
||||
essentialHackType = 2;
|
||||
} else if (essentialNumChildren === 5) {
|
||||
essentialHackType = 3;
|
||||
}
|
||||
if (essentialHackType > 0) {
|
||||
essentialContainer.setAttribute('data-hack-type', essentialHackType);
|
||||
} else {
|
||||
essentialContainer.removeAttribute('data-hack-type');
|
||||
}
|
||||
this._updateMarginTopPinnedTabs(arrowScrollbox, pinnedContainer, essentialContainer, workspaceIndicator, forAnimation);
|
||||
this._updateMarginTopPinnedTabs(
|
||||
arrowScrollbox,
|
||||
pinnedContainer,
|
||||
essentialContainer,
|
||||
workspaceIndicator,
|
||||
forAnimation,
|
||||
animateContainer
|
||||
);
|
||||
this.updateShouldHideSeparator(arrowScrollbox, pinnedContainer);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user