mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-05 09:26:34 +00:00
Fixed opening tab in a new container not changing the tab to the correct forced workspace
This commit is contained in:
@@ -49,6 +49,7 @@
|
|||||||
--in-content-box-border-color: var(--zen-colors-border) !important;
|
--in-content-box-border-color: var(--zen-colors-border) !important;
|
||||||
|
|
||||||
--in-content-accent-color: var(--zen-colors-primary) !important;
|
--in-content-accent-color: var(--zen-colors-primary) !important;
|
||||||
|
--in-content-accent-color-active: currentColor !important;
|
||||||
|
|
||||||
/* This is like the secondary button */
|
/* This is like the secondary button */
|
||||||
--in-content-button-background: transparent !important;
|
--in-content-button-background: transparent !important;
|
||||||
|
@@ -139,45 +139,45 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
|||||||
|
|
||||||
toolbox.addEventListener('wheel', async (event) => {
|
toolbox.addEventListener('wheel', async (event) => {
|
||||||
if (!this.workspaceEnabled) return;
|
if (!this.workspaceEnabled) return;
|
||||||
|
|
||||||
// Only process non-gesture scrolls
|
// Only process non-gesture scrolls
|
||||||
if (event.deltaMode !== 1) return;
|
if (event.deltaMode !== 1) return;
|
||||||
|
|
||||||
const isVerticalScroll = event.deltaY && !event.deltaX;
|
const isVerticalScroll = event.deltaY && !event.deltaX;
|
||||||
const isHorizontalScroll = event.deltaX && !event.deltaY;
|
const isHorizontalScroll = event.deltaX && !event.deltaY;
|
||||||
|
|
||||||
//if the scroll is vertical this checks that a modifier key is used before proceeding
|
//if the scroll is vertical this checks that a modifier key is used before proceeding
|
||||||
if (isVerticalScroll) {
|
if (isVerticalScroll) {
|
||||||
|
|
||||||
const activationKeyMap = {
|
const activationKeyMap = {
|
||||||
ctrl: event.ctrlKey,
|
ctrl: event.ctrlKey,
|
||||||
alt: event.altKey,
|
alt: event.altKey,
|
||||||
shift: event.shiftKey,
|
shift: event.shiftKey,
|
||||||
meta: event.metaKey,
|
meta: event.metaKey,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.activationMethod in activationKeyMap && !activationKeyMap[this.activationMethod]) {
|
if (this.activationMethod in activationKeyMap && !activationKeyMap[this.activationMethod]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentTime = Date.now();
|
const currentTime = Date.now();
|
||||||
if (currentTime - this._lastScrollTime < scrollCooldown) return;
|
if (currentTime - this._lastScrollTime < scrollCooldown) return;
|
||||||
|
|
||||||
//this decides which delta to use
|
//this decides which delta to use
|
||||||
const delta = isVerticalScroll ? event.deltaY : event.deltaX;
|
const delta = isVerticalScroll ? event.deltaY : event.deltaX;
|
||||||
if (Math.abs(delta) < scrollThreshold) return;
|
if (Math.abs(delta) < scrollThreshold) return;
|
||||||
|
|
||||||
// Determine scroll direction
|
// Determine scroll direction
|
||||||
const direction = delta > 0 ? -1 : 1;
|
const direction = delta > 0 ? -1 : 1;
|
||||||
|
|
||||||
// Workspace logic
|
// Workspace logic
|
||||||
const workspaces = (await this._workspaces()).workspaces;
|
const workspaces = (await this._workspaces()).workspaces;
|
||||||
const currentIndex = workspaces.findIndex(w => w.uuid === this.activeWorkspace);
|
const currentIndex = workspaces.findIndex(w => w.uuid === this.activeWorkspace);
|
||||||
if (currentIndex === -1) return; // No valid current workspace
|
if (currentIndex === -1) return; // No valid current workspace
|
||||||
|
|
||||||
let targetIndex = currentIndex + direction;
|
let targetIndex = currentIndex + direction;
|
||||||
|
|
||||||
if (this.shouldWrapAroundNavigation) {
|
if (this.shouldWrapAroundNavigation) {
|
||||||
// Add length to handle negative indices and loop
|
// Add length to handle negative indices and loop
|
||||||
targetIndex = (targetIndex + workspaces.length) % workspaces.length;
|
targetIndex = (targetIndex + workspaces.length) % workspaces.length;
|
||||||
@@ -185,11 +185,11 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
|||||||
// Clamp within bounds to disable looping
|
// Clamp within bounds to disable looping
|
||||||
targetIndex = Math.max(0, Math.min(workspaces.length - 1, targetIndex));
|
targetIndex = Math.max(0, Math.min(workspaces.length - 1, targetIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetIndex !== currentIndex) {
|
if (targetIndex !== currentIndex) {
|
||||||
await this.changeWorkspace(workspaces[targetIndex]);
|
await this.changeWorkspace(workspaces[targetIndex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._lastScrollTime = currentTime;
|
this._lastScrollTime = currentTime;
|
||||||
}, { passive: true });
|
}, { passive: true });
|
||||||
}
|
}
|
||||||
@@ -270,11 +270,11 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
|||||||
if (currentIndex !== -1) {
|
if (currentIndex !== -1) {
|
||||||
const isRTL = document.documentElement.matches(':-moz-locale-dir(rtl)');
|
const isRTL = document.documentElement.matches(':-moz-locale-dir(rtl)');
|
||||||
const moveForward = (this._swipeState.direction === 'right') !== isRTL;
|
const moveForward = (this._swipeState.direction === 'right') !== isRTL;
|
||||||
|
|
||||||
let targetIndex = moveForward
|
let targetIndex = moveForward
|
||||||
? currentIndex + 1
|
? currentIndex + 1
|
||||||
: currentIndex - 1;
|
: currentIndex - 1;
|
||||||
|
|
||||||
if (this.shouldWrapAroundNavigation) {
|
if (this.shouldWrapAroundNavigation) {
|
||||||
// Add length to handle negative indices and clamp within bounds
|
// Add length to handle negative indices and clamp within bounds
|
||||||
targetIndex = (targetIndex + workspaces.length) % workspaces.length;
|
targetIndex = (targetIndex + workspaces.length) % workspaces.length;
|
||||||
@@ -282,7 +282,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
|||||||
// Clamp within bounds for to remove looping
|
// Clamp within bounds for to remove looping
|
||||||
targetIndex = Math.max(0, Math.min(workspaces.length - 1, targetIndex));
|
targetIndex = Math.max(0, Math.min(workspaces.length - 1, targetIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetIndex !== currentIndex) {
|
if (targetIndex !== currentIndex) {
|
||||||
await this.changeWorkspace(workspaces[targetIndex]);
|
await this.changeWorkspace(workspaces[targetIndex]);
|
||||||
}
|
}
|
||||||
@@ -1602,7 +1602,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
|||||||
|
|
||||||
getContextIdIfNeeded(userContextId, fromExternal, allowInheritPrincipal) {
|
getContextIdIfNeeded(userContextId, fromExternal, allowInheritPrincipal) {
|
||||||
if (!this.workspaceEnabled) {
|
if (!this.workspaceEnabled) {
|
||||||
return [userContextId, false];
|
return [userContextId, false, undefined];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.shouldForceContainerTabsToWorkspace && typeof userContextId !== 'undefined' && this._workspaceCache?.workspaces) {
|
if (this.shouldForceContainerTabsToWorkspace && typeof userContextId !== 'undefined' && this._workspaceCache?.workspaces) {
|
||||||
@@ -1614,7 +1614,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
|||||||
const workspace = matchingWorkspaces[0];
|
const workspace = matchingWorkspaces[0];
|
||||||
if (workspace.uuid !== this.getActiveWorkspaceFromCache().uuid) {
|
if (workspace.uuid !== this.getActiveWorkspaceFromCache().uuid) {
|
||||||
this.changeWorkspace(workspace);
|
this.changeWorkspace(workspace);
|
||||||
return [userContextId, true];
|
return [userContextId, true, workspace.uuid];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1623,13 +1623,13 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
|||||||
const activeWorkspaceUserContextId = activeWorkspace?.containerTabId;
|
const activeWorkspaceUserContextId = activeWorkspace?.containerTabId;
|
||||||
|
|
||||||
if ((fromExternal || allowInheritPrincipal === false) && !!activeWorkspaceUserContextId) {
|
if ((fromExternal || allowInheritPrincipal === false) && !!activeWorkspaceUserContextId) {
|
||||||
return [activeWorkspaceUserContextId, true];
|
return [activeWorkspaceUserContextId, true, undefined];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof userContextId !== 'undefined' && userContextId !== activeWorkspaceUserContextId) {
|
if (typeof userContextId !== 'undefined' && userContextId !== activeWorkspaceUserContextId) {
|
||||||
return [userContextId, false];
|
return [userContextId, false, undefined];
|
||||||
}
|
}
|
||||||
return [activeWorkspaceUserContextId, true];
|
return [activeWorkspaceUserContextId, true, undefined];
|
||||||
}
|
}
|
||||||
|
|
||||||
async shortcutSwitchTo(index) {
|
async shortcutSwitchTo(index) {
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
|
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
|
||||||
index fec3dc8129a4d235fdd05e0390145a02064ebaa5..636b56754f48c1ec931152cf34bab8414a75cebc 100644
|
index fec3dc8129a4d235fdd05e0390145a02064ebaa5..8eab9fc985ca701a11b309acfada415bbc9b9800 100644
|
||||||
--- a/browser/components/tabbrowser/content/tabbrowser.js
|
--- a/browser/components/tabbrowser/content/tabbrowser.js
|
||||||
+++ b/browser/components/tabbrowser/content/tabbrowser.js
|
+++ b/browser/components/tabbrowser/content/tabbrowser.js
|
||||||
@@ -402,11 +402,26 @@
|
@@ -402,11 +402,26 @@
|
||||||
@@ -84,29 +84,33 @@ index fec3dc8129a4d235fdd05e0390145a02064ebaa5..636b56754f48c1ec931152cf34bab841
|
|||||||
} else {
|
} else {
|
||||||
aTab.linkedBrowser.browsingContext.hasSiblings = this.tabs.length > 1;
|
aTab.linkedBrowser.browsingContext.hasSiblings = this.tabs.length > 1;
|
||||||
}
|
}
|
||||||
@@ -2651,6 +2671,11 @@
|
@@ -2651,6 +2671,12 @@
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ let hasZenDefaultUserContextId = false;
|
+ let hasZenDefaultUserContextId = false;
|
||||||
|
+ let zenForcedWorkspaceId = undefined;
|
||||||
+ if (typeof ZenWorkspaces !== "undefined") {
|
+ if (typeof ZenWorkspaces !== "undefined") {
|
||||||
+ [userContextId, hasZenDefaultUserContextId] = ZenWorkspaces.getContextIdIfNeeded(userContextId, fromExternal, allowInheritPrincipal);
|
+ [userContextId, hasZenDefaultUserContextId, zenForcedWorkspaceId] = ZenWorkspaces.getContextIdIfNeeded(userContextId, fromExternal, allowInheritPrincipal);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
if (!UserInteraction.running("browser.tabs.opening", window)) {
|
if (!UserInteraction.running("browser.tabs.opening", window)) {
|
||||||
UserInteraction.start("browser.tabs.opening", "initting", window);
|
UserInteraction.start("browser.tabs.opening", "initting", window);
|
||||||
}
|
}
|
||||||
@@ -2720,6 +2745,9 @@
|
@@ -2720,6 +2746,12 @@
|
||||||
noInitialLabel,
|
noInitialLabel,
|
||||||
skipBackgroundNotify,
|
skipBackgroundNotify,
|
||||||
});
|
});
|
||||||
+ if (hasZenDefaultUserContextId) {
|
+ if (hasZenDefaultUserContextId) {
|
||||||
+ t.setAttribute("zenDefaultUserContextId", "true");
|
+ t.setAttribute("zenDefaultUserContextId", "true");
|
||||||
|
+ }
|
||||||
|
+ if (zenForcedWorkspaceId !== undefined) {
|
||||||
|
+ t.setAttribute("zen-workspace-id", zenForcedWorkspaceId);
|
||||||
+ }
|
+ }
|
||||||
if (insertTab) {
|
if (insertTab) {
|
||||||
// insert the tab into the tab container in the correct position
|
// insert the tab into the tab container in the correct position
|
||||||
this._insertTabAtIndex(t, {
|
this._insertTabAtIndex(t, {
|
||||||
@@ -3342,6 +3370,23 @@
|
@@ -3342,6 +3374,23 @@
|
||||||
) {
|
) {
|
||||||
tabWasReused = true;
|
tabWasReused = true;
|
||||||
tab = this.selectedTab;
|
tab = this.selectedTab;
|
||||||
@@ -130,7 +134,7 @@ index fec3dc8129a4d235fdd05e0390145a02064ebaa5..636b56754f48c1ec931152cf34bab841
|
|||||||
if (!tabData.pinned) {
|
if (!tabData.pinned) {
|
||||||
this.unpinTab(tab);
|
this.unpinTab(tab);
|
||||||
} else {
|
} else {
|
||||||
@@ -3355,6 +3400,9 @@
|
@@ -3355,6 +3404,9 @@
|
||||||
restoreTabsLazily && !select && !tabData.pinned;
|
restoreTabsLazily && !select && !tabData.pinned;
|
||||||
|
|
||||||
let url = "about:blank";
|
let url = "about:blank";
|
||||||
@@ -140,7 +144,7 @@ index fec3dc8129a4d235fdd05e0390145a02064ebaa5..636b56754f48c1ec931152cf34bab841
|
|||||||
if (tabData.entries?.length) {
|
if (tabData.entries?.length) {
|
||||||
let activeIndex = (tabData.index || tabData.entries.length) - 1;
|
let activeIndex = (tabData.index || tabData.entries.length) - 1;
|
||||||
// Ensure the index is in bounds.
|
// Ensure the index is in bounds.
|
||||||
@@ -3391,6 +3439,21 @@
|
@@ -3391,6 +3443,21 @@
|
||||||
preferredRemoteType,
|
preferredRemoteType,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -162,7 +166,7 @@ index fec3dc8129a4d235fdd05e0390145a02064ebaa5..636b56754f48c1ec931152cf34bab841
|
|||||||
if (select) {
|
if (select) {
|
||||||
tabToSelect = tab;
|
tabToSelect = tab;
|
||||||
}
|
}
|
||||||
@@ -3444,7 +3507,6 @@
|
@@ -3444,7 +3511,6 @@
|
||||||
this.tabContainer._invalidateCachedTabs();
|
this.tabContainer._invalidateCachedTabs();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -170,7 +174,7 @@ index fec3dc8129a4d235fdd05e0390145a02064ebaa5..636b56754f48c1ec931152cf34bab841
|
|||||||
tab.initialize();
|
tab.initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3992,6 +4054,10 @@
|
@@ -3992,6 +4058,10 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,7 +185,7 @@ index fec3dc8129a4d235fdd05e0390145a02064ebaa5..636b56754f48c1ec931152cf34bab841
|
|||||||
this.removeTabs(selectedTabs);
|
this.removeTabs(selectedTabs);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -4309,6 +4375,13 @@
|
@@ -4309,6 +4379,13 @@
|
||||||
TelemetryStopwatch.start("FX_TAB_CLOSE_TIME_NO_ANIM_MS", aTab);
|
TelemetryStopwatch.start("FX_TAB_CLOSE_TIME_NO_ANIM_MS", aTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,7 +199,7 @@ index fec3dc8129a4d235fdd05e0390145a02064ebaa5..636b56754f48c1ec931152cf34bab841
|
|||||||
// Handle requests for synchronously removing an already
|
// Handle requests for synchronously removing an already
|
||||||
// asynchronously closing tab.
|
// asynchronously closing tab.
|
||||||
if (!animate && aTab.closing) {
|
if (!animate && aTab.closing) {
|
||||||
@@ -4324,6 +4397,10 @@
|
@@ -4324,6 +4401,10 @@
|
||||||
// state).
|
// state).
|
||||||
let tabWidth = window.windowUtils.getBoundsWithoutFlushing(aTab).width;
|
let tabWidth = window.windowUtils.getBoundsWithoutFlushing(aTab).width;
|
||||||
|
|
||||||
@@ -206,7 +210,7 @@ index fec3dc8129a4d235fdd05e0390145a02064ebaa5..636b56754f48c1ec931152cf34bab841
|
|||||||
if (
|
if (
|
||||||
!this._beginRemoveTab(aTab, {
|
!this._beginRemoveTab(aTab, {
|
||||||
closeWindowFastpath: true,
|
closeWindowFastpath: true,
|
||||||
@@ -4472,7 +4549,7 @@
|
@@ -4472,7 +4553,7 @@
|
||||||
|
|
||||||
var closeWindow = false;
|
var closeWindow = false;
|
||||||
var newTab = false;
|
var newTab = false;
|
||||||
@@ -215,7 +219,7 @@ index fec3dc8129a4d235fdd05e0390145a02064ebaa5..636b56754f48c1ec931152cf34bab841
|
|||||||
closeWindow =
|
closeWindow =
|
||||||
closeWindowWithLastTab != null
|
closeWindowWithLastTab != null
|
||||||
? closeWindowWithLastTab
|
? closeWindowWithLastTab
|
||||||
@@ -5265,10 +5342,10 @@
|
@@ -5265,10 +5346,10 @@
|
||||||
SessionStore.deleteCustomTabValue(aTab, "hiddenBy");
|
SessionStore.deleteCustomTabValue(aTab, "hiddenBy");
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -228,7 +232,7 @@ index fec3dc8129a4d235fdd05e0390145a02064ebaa5..636b56754f48c1ec931152cf34bab841
|
|||||||
aTab.selected ||
|
aTab.selected ||
|
||||||
aTab.closing ||
|
aTab.closing ||
|
||||||
// Tabs that are sharing the screen, microphone or camera cannot be hidden.
|
// Tabs that are sharing the screen, microphone or camera cannot be hidden.
|
||||||
@@ -7181,6 +7258,7 @@
|
@@ -7181,6 +7262,7 @@
|
||||||
aWebProgress.isTopLevel
|
aWebProgress.isTopLevel
|
||||||
) {
|
) {
|
||||||
this.mTab.setAttribute("busy", "true");
|
this.mTab.setAttribute("busy", "true");
|
||||||
@@ -236,7 +240,7 @@ index fec3dc8129a4d235fdd05e0390145a02064ebaa5..636b56754f48c1ec931152cf34bab841
|
|||||||
gBrowser._tabAttrModified(this.mTab, ["busy"]);
|
gBrowser._tabAttrModified(this.mTab, ["busy"]);
|
||||||
this.mTab._notselectedsinceload = !this.mTab.selected;
|
this.mTab._notselectedsinceload = !this.mTab.selected;
|
||||||
gBrowser.syncThrobberAnimations(this.mTab);
|
gBrowser.syncThrobberAnimations(this.mTab);
|
||||||
@@ -8114,7 +8192,7 @@ var TabContextMenu = {
|
@@ -8114,7 +8196,7 @@ var TabContextMenu = {
|
||||||
);
|
);
|
||||||
contextUnpinSelectedTabs.hidden =
|
contextUnpinSelectedTabs.hidden =
|
||||||
!this.contextTab.pinned || !multiselectionContext;
|
!this.contextTab.pinned || !multiselectionContext;
|
||||||
@@ -245,7 +249,7 @@ index fec3dc8129a4d235fdd05e0390145a02064ebaa5..636b56754f48c1ec931152cf34bab841
|
|||||||
// Move Tab items
|
// Move Tab items
|
||||||
let contextMoveTabOptions = document.getElementById(
|
let contextMoveTabOptions = document.getElementById(
|
||||||
"context_moveTabOptions"
|
"context_moveTabOptions"
|
||||||
@@ -8148,7 +8226,7 @@ var TabContextMenu = {
|
@@ -8148,7 +8230,7 @@ var TabContextMenu = {
|
||||||
let contextMoveTabToStart = document.getElementById("context_moveToStart");
|
let contextMoveTabToStart = document.getElementById("context_moveToStart");
|
||||||
let isFirstTab =
|
let isFirstTab =
|
||||||
tabsToMove[0] == visibleTabs[0] ||
|
tabsToMove[0] == visibleTabs[0] ||
|
||||||
@@ -254,7 +258,7 @@ index fec3dc8129a4d235fdd05e0390145a02064ebaa5..636b56754f48c1ec931152cf34bab841
|
|||||||
contextMoveTabToStart.disabled = isFirstTab && allSelectedTabsAdjacent;
|
contextMoveTabToStart.disabled = isFirstTab && allSelectedTabsAdjacent;
|
||||||
|
|
||||||
document.getElementById("context_openTabInWindow").disabled =
|
document.getElementById("context_openTabInWindow").disabled =
|
||||||
@@ -8376,6 +8454,7 @@ var TabContextMenu = {
|
@@ -8376,6 +8458,7 @@ var TabContextMenu = {
|
||||||
if (this.contextTab.multiselected) {
|
if (this.contextTab.multiselected) {
|
||||||
gBrowser.removeMultiSelectedTabs();
|
gBrowser.removeMultiSelectedTabs();
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user