mirror of
https://github.com/zen-browser/desktop.git
synced 2026-04-04 22:59:46 +00:00
chore: Format with only a maximum of 10 columns, b=(no-bug), c=workflows, common, compact-mode, folders, glance, kbs, media, mods, split-view, tabs, tests, workspaces, welcome
This commit is contained in:
@@ -13,12 +13,17 @@
|
||||
useAlgo = '';
|
||||
constructor() {
|
||||
super();
|
||||
if (!Services.prefs.getBoolPref('zen.theme.gradient', true) || !ZenWorkspaces.shouldHaveWorkspaces) {
|
||||
if (
|
||||
!Services.prefs.getBoolPref('zen.theme.gradient', true) ||
|
||||
!ZenWorkspaces.shouldHaveWorkspaces
|
||||
) {
|
||||
return;
|
||||
}
|
||||
this.dragStartPosition = null;
|
||||
|
||||
ChromeUtils.defineLazyGetter(this, 'panel', () => document.getElementById('PanelUI-zen-gradient-generator'));
|
||||
ChromeUtils.defineLazyGetter(this, 'panel', () =>
|
||||
document.getElementById('PanelUI-zen-gradient-generator')
|
||||
);
|
||||
ChromeUtils.defineLazyGetter(this, 'toolbox', () => document.getElementById('TabsToolbar'));
|
||||
ChromeUtils.defineLazyGetter(this, 'customColorInput', () =>
|
||||
document.getElementById('PanelUI-zen-gradient-generator-custom-input')
|
||||
@@ -48,7 +53,9 @@
|
||||
this.initTextureInput();
|
||||
this.initRotationInput();
|
||||
|
||||
window.matchMedia('(prefers-color-scheme: dark)').addListener(this.onDarkModeChange.bind(this));
|
||||
window
|
||||
.matchMedia('(prefers-color-scheme: dark)')
|
||||
.addListener(this.onDarkModeChange.bind(this));
|
||||
}
|
||||
|
||||
get isDarkMode() {
|
||||
@@ -110,50 +117,52 @@
|
||||
}
|
||||
|
||||
initPredefinedColors() {
|
||||
document.getElementById('PanelUI-zen-gradient-generator-predefined').addEventListener('click', async (event) => {
|
||||
const target = event.target;
|
||||
const rawPosition = target.getAttribute('data-position');
|
||||
if (!rawPosition) {
|
||||
return;
|
||||
}
|
||||
const algo = target.getAttribute('data-algo');
|
||||
const numDots = parseInt(target.getAttribute('data-num-dots'));
|
||||
if (algo == 'float') {
|
||||
for (const dot of this.dots) {
|
||||
dot.element.remove();
|
||||
document
|
||||
.getElementById('PanelUI-zen-gradient-generator-predefined')
|
||||
.addEventListener('click', async (event) => {
|
||||
const target = event.target;
|
||||
const rawPosition = target.getAttribute('data-position');
|
||||
if (!rawPosition) {
|
||||
return;
|
||||
}
|
||||
this.dots = [];
|
||||
} else if (numDots < this.dots.length) {
|
||||
for (let i = numDots; i < this.dots.length; i++) {
|
||||
this.dots[i].element.remove();
|
||||
const algo = target.getAttribute('data-algo');
|
||||
const numDots = parseInt(target.getAttribute('data-num-dots'));
|
||||
if (algo == 'float') {
|
||||
for (const dot of this.dots) {
|
||||
dot.element.remove();
|
||||
}
|
||||
this.dots = [];
|
||||
} else if (numDots < this.dots.length) {
|
||||
for (let i = numDots; i < this.dots.length; i++) {
|
||||
this.dots[i].element.remove();
|
||||
}
|
||||
this.dots = this.dots.slice(0, numDots);
|
||||
}
|
||||
this.dots = this.dots.slice(0, numDots);
|
||||
}
|
||||
// Generate new gradient from the single color given
|
||||
const [x, y] = rawPosition.split(',').map((pos) => parseInt(pos));
|
||||
let dots = [
|
||||
{
|
||||
ID: 0,
|
||||
position: { x, y },
|
||||
},
|
||||
];
|
||||
for (let i = 1; i < numDots; i++) {
|
||||
dots.push({
|
||||
ID: i,
|
||||
position: { x: 0, y: 0 },
|
||||
});
|
||||
}
|
||||
this.useAlgo = algo;
|
||||
dots = this.calculateCompliments(dots, 'update', this.useAlgo);
|
||||
if (algo == 'float') {
|
||||
for (const dot of dots) {
|
||||
this.spawnDot(dot.position);
|
||||
// Generate new gradient from the single color given
|
||||
const [x, y] = rawPosition.split(',').map((pos) => parseInt(pos));
|
||||
let dots = [
|
||||
{
|
||||
ID: 0,
|
||||
position: { x, y },
|
||||
},
|
||||
];
|
||||
for (let i = 1; i < numDots; i++) {
|
||||
dots.push({
|
||||
ID: i,
|
||||
position: { x: 0, y: 0 },
|
||||
});
|
||||
}
|
||||
this.dots[0].element.classList.add('primary');
|
||||
}
|
||||
this.handleColorPositions(dots);
|
||||
this.updateCurrentWorkspace();
|
||||
});
|
||||
this.useAlgo = algo;
|
||||
dots = this.calculateCompliments(dots, 'update', this.useAlgo);
|
||||
if (algo == 'float') {
|
||||
for (const dot of dots) {
|
||||
this.spawnDot(dot.position);
|
||||
}
|
||||
this.dots[0].element.classList.add('primary');
|
||||
}
|
||||
this.handleColorPositions(dots);
|
||||
this.updateCurrentWorkspace();
|
||||
});
|
||||
}
|
||||
|
||||
initCustomColorInput() {
|
||||
@@ -383,8 +392,12 @@
|
||||
<toolbarbutton class="zen-theme-picker-custom-list-item-remove toolbarbutton-1"></toolbarbutton>
|
||||
</hbox>
|
||||
`);
|
||||
listItems.querySelector('.zen-theme-picker-custom-list-item').setAttribute('data-color', color);
|
||||
listItems.querySelector('.zen-theme-picker-dot').style.setProperty('--zen-theme-picker-dot-color', color);
|
||||
listItems
|
||||
.querySelector('.zen-theme-picker-custom-list-item')
|
||||
.setAttribute('data-color', color);
|
||||
listItems
|
||||
.querySelector('.zen-theme-picker-dot')
|
||||
.style.setProperty('--zen-theme-picker-dot-color', color);
|
||||
listItems.querySelector('.zen-theme-picker-custom-list-item-label').textContent = color;
|
||||
listItems
|
||||
.querySelector('.zen-theme-picker-custom-list-item-remove')
|
||||
@@ -452,7 +465,10 @@
|
||||
}
|
||||
|
||||
const colorFromPos = this.getColorFromPosition(relativePosition.x, relativePosition.y);
|
||||
dot.style.setProperty('--zen-theme-picker-dot-color', `rgb(${colorFromPos[0]}, ${colorFromPos[1]}, ${colorFromPos[2]})`);
|
||||
dot.style.setProperty(
|
||||
'--zen-theme-picker-dot-color',
|
||||
`rgb(${colorFromPos[0]}, ${colorFromPos[1]}, ${colorFromPos[2]})`
|
||||
);
|
||||
|
||||
this.dots.push({
|
||||
ID: id,
|
||||
@@ -481,13 +497,17 @@
|
||||
if (selectedHarmony) {
|
||||
if (action === 'remove') {
|
||||
if (dots.length !== 0) {
|
||||
return colorHarmonies.find((harmony) => harmony.angles.length === selectedHarmony.angles.length - 1);
|
||||
return colorHarmonies.find(
|
||||
(harmony) => harmony.angles.length === selectedHarmony.angles.length - 1
|
||||
);
|
||||
} else {
|
||||
return { type: 'floating', angles: [] };
|
||||
}
|
||||
}
|
||||
if (action === 'add') {
|
||||
return colorHarmonies.find((harmony) => harmony.angles.length === selectedHarmony.angles.length + 1);
|
||||
return colorHarmonies.find(
|
||||
(harmony) => harmony.angles.length === selectedHarmony.angles.length + 1
|
||||
);
|
||||
}
|
||||
if (action === 'update') {
|
||||
return selectedHarmony;
|
||||
@@ -526,7 +546,10 @@
|
||||
let updatedDots = [...dots];
|
||||
const centerPosition = { x: rect.width / 2, y: rect.height / 2 };
|
||||
|
||||
const harmonyAngles = getColorHarmonyType(dots.length + (action === 'add' ? 1 : action === 'remove' ? -1 : 0), this.dots);
|
||||
const harmonyAngles = getColorHarmonyType(
|
||||
dots.length + (action === 'add' ? 1 : action === 'remove' ? -1 : 0),
|
||||
this.dots
|
||||
);
|
||||
this.useAlgo = harmonyAngles.type;
|
||||
if (!harmonyAngles || harmonyAngles.angles.length === 0) return dots;
|
||||
|
||||
@@ -594,7 +617,10 @@
|
||||
|
||||
if (existingPrimaryDot) {
|
||||
existingPrimaryDot.element.style.zIndex = 999;
|
||||
const colorFromPos = this.getColorFromPosition(existingPrimaryDot.position.x, existingPrimaryDot.position.y);
|
||||
const colorFromPos = this.getColorFromPosition(
|
||||
existingPrimaryDot.position.x,
|
||||
existingPrimaryDot.position.y
|
||||
);
|
||||
existingPrimaryDot.element.style.setProperty(
|
||||
'--zen-theme-picker-dot-color',
|
||||
`rgb(${colorFromPos[0]}, ${colorFromPos[1]}, ${colorFromPos[2]})`
|
||||
@@ -606,7 +632,10 @@
|
||||
|
||||
if (existingDot) {
|
||||
existingDot.position = dotPosition.position;
|
||||
const colorFromPos = this.getColorFromPosition(dotPosition.position.x, dotPosition.position.y);
|
||||
const colorFromPos = this.getColorFromPosition(
|
||||
dotPosition.position.x,
|
||||
dotPosition.position.y
|
||||
);
|
||||
existingDot.element.style.setProperty(
|
||||
'--zen-theme-picker-dot-color',
|
||||
`rgb(${colorFromPos[0]}, ${colorFromPos[1]}, ${colorFromPos[2]})`
|
||||
@@ -681,7 +710,9 @@
|
||||
(harmony) => harmony.angles.length + 1 === this.dots.length || harmony.type === 'floating'
|
||||
);
|
||||
|
||||
let currentIndex = applicableHarmonies.findIndex((harmony) => harmony.type === this.useAlgo);
|
||||
let currentIndex = applicableHarmonies.findIndex(
|
||||
(harmony) => harmony.type === this.useAlgo
|
||||
);
|
||||
|
||||
let nextIndex = currentIndex === -1 ? 0 : (currentIndex + 1) % applicableHarmonies.length;
|
||||
this.useAlgo = applicableHarmonies[nextIndex].type;
|
||||
@@ -875,7 +906,11 @@
|
||||
return colors.map((color) => ({
|
||||
c: color.isCustom
|
||||
? color.c
|
||||
: [Math.min(255, color.c[0] * factor), Math.min(255, color.c[1] * factor), Math.min(255, color.c[2] * factor)],
|
||||
: [
|
||||
Math.min(255, color.c[0] * factor),
|
||||
Math.min(255, color.c[1] * factor),
|
||||
Math.min(255, color.c[2] * factor),
|
||||
],
|
||||
isCustom: color.isCustom,
|
||||
algorithm: color.algorithm,
|
||||
}));
|
||||
@@ -908,7 +943,9 @@
|
||||
this.useAlgo = themedColors[0]?.algorithm ?? '';
|
||||
|
||||
if (themedColors.length === 0) {
|
||||
return forToolbar ? 'var(--zen-themed-toolbar-bg)' : 'var(--zen-themed-toolbar-bg-transparent)';
|
||||
return forToolbar
|
||||
? 'var(--zen-themed-toolbar-bg)'
|
||||
: 'var(--zen-themed-toolbar-bg-transparent)';
|
||||
} else if (themedColors.length === 1) {
|
||||
return this.getSingleRGBColor(themedColors[0], forToolbar);
|
||||
} else if (themedColors.length !== 3) {
|
||||
@@ -945,7 +982,11 @@
|
||||
.map((char) => char + char)
|
||||
.join('');
|
||||
}
|
||||
return [parseInt(hex.substring(0, 2), 16), parseInt(hex.substring(2, 4), 16), parseInt(hex.substring(4, 6), 16)];
|
||||
return [
|
||||
parseInt(hex.substring(0, 2), 16),
|
||||
parseInt(hex.substring(2, 4), 16),
|
||||
parseInt(hex.substring(4, 6), 16),
|
||||
];
|
||||
}
|
||||
|
||||
pSBC = (p, c0, c1, l) => {
|
||||
@@ -959,7 +1000,14 @@
|
||||
i = parseInt,
|
||||
m = Math.round,
|
||||
a = typeof c1 == 'string';
|
||||
if (typeof p != 'number' || p < -1 || p > 1 || typeof c0 != 'string' || (c0[0] != 'r' && c0[0] != '#') || (c1 && !a))
|
||||
if (
|
||||
typeof p != 'number' ||
|
||||
p < -1 ||
|
||||
p > 1 ||
|
||||
typeof c0 != 'string' ||
|
||||
(c0[0] != 'r' && c0[0] != '#') ||
|
||||
(c1 && !a)
|
||||
)
|
||||
return null;
|
||||
if (!this.pSBCr)
|
||||
this.pSBCr = (d) => {
|
||||
@@ -968,13 +1016,20 @@
|
||||
if (n > 9) {
|
||||
([r, g, b, a] = d = d.split(',')), (n = d.length);
|
||||
if (n < 3 || n > 4) return null;
|
||||
(x.r = i(r[3] == 'a' ? r.slice(5) : r.slice(4))), (x.g = i(g)), (x.b = i(b)), (x.a = a ? parseFloat(a) : -1);
|
||||
(x.r = i(r[3] == 'a' ? r.slice(5) : r.slice(4))),
|
||||
(x.g = i(g)),
|
||||
(x.b = i(b)),
|
||||
(x.a = a ? parseFloat(a) : -1);
|
||||
} else {
|
||||
if (n == 8 || n == 6 || n < 4) return null;
|
||||
if (n < 6) d = '#' + d[1] + d[1] + d[2] + d[2] + d[3] + d[3] + (n > 4 ? d[4] + d[4] : '');
|
||||
if (n < 6)
|
||||
d = '#' + d[1] + d[1] + d[2] + d[2] + d[3] + d[3] + (n > 4 ? d[4] + d[4] : '');
|
||||
d = i(d.slice(1), 16);
|
||||
if (n == 9 || n == 5)
|
||||
(x.r = (d >> 24) & 255), (x.g = (d >> 16) & 255), (x.b = (d >> 8) & 255), (x.a = m((d & 255) / 0.255) / 1000);
|
||||
(x.r = (d >> 24) & 255),
|
||||
(x.g = (d >> 16) & 255),
|
||||
(x.b = (d >> 8) & 255),
|
||||
(x.a = m((d & 255) / 0.255) / 1000);
|
||||
else (x.r = d >> 16), (x.g = (d >> 8) & 255), (x.b = d & 255), (x.a = -1);
|
||||
}
|
||||
return x;
|
||||
@@ -983,7 +1038,12 @@
|
||||
(h = a ? (c1.length > 9 ? true : c1 == 'c' ? !h : false) : h),
|
||||
(f = this.pSBCr(c0)),
|
||||
(P = p < 0),
|
||||
(t = c1 && c1 != 'c' ? this.pSBCr(c1) : P ? { r: 0, g: 0, b: 0, a: -1 } : { r: 255, g: 255, b: 255, a: -1 }),
|
||||
(t =
|
||||
c1 && c1 != 'c'
|
||||
? this.pSBCr(c1)
|
||||
: P
|
||||
? { r: 0, g: 0, b: 0, a: -1 }
|
||||
: { r: 255, g: 255, b: 255, a: -1 }),
|
||||
(p = P ? p * -1 : p),
|
||||
(P = 1 - p);
|
||||
if (!f || !t) return null;
|
||||
@@ -992,12 +1052,28 @@
|
||||
(r = m((P * f.r ** 2 + p * t.r ** 2) ** 0.5)),
|
||||
(g = m((P * f.g ** 2 + p * t.g ** 2) ** 0.5)),
|
||||
(b = m((P * f.b ** 2 + p * t.b ** 2) ** 0.5));
|
||||
(a = f.a), (t = t.a), (f = a >= 0 || t >= 0), (a = f ? (a < 0 ? t : t < 0 ? a : a * P + t * p) : 0);
|
||||
if (h) return 'rgb' + (f ? 'a(' : '(') + r + ',' + g + ',' + b + (f ? ',' + m(a * 1000) / 1000 : '') + ')';
|
||||
(a = f.a),
|
||||
(t = t.a),
|
||||
(f = a >= 0 || t >= 0),
|
||||
(a = f ? (a < 0 ? t : t < 0 ? a : a * P + t * p) : 0);
|
||||
if (h)
|
||||
return (
|
||||
'rgb' +
|
||||
(f ? 'a(' : '(') +
|
||||
r +
|
||||
',' +
|
||||
g +
|
||||
',' +
|
||||
b +
|
||||
(f ? ',' + m(a * 1000) / 1000 : '') +
|
||||
')'
|
||||
);
|
||||
else
|
||||
return (
|
||||
'#' +
|
||||
(4294967296 + r * 16777216 + g * 65536 + b * 256 + (f ? m(a * 255) : 0)).toString(16).slice(1, f ? undefined : -2)
|
||||
(4294967296 + r * 16777216 + g * 65536 + b * 256 + (f ? m(a * 255) : 0))
|
||||
.toString(16)
|
||||
.slice(1, f ? undefined : -2)
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1033,7 +1109,9 @@
|
||||
workspaceTheme = this.fixTheme(theme || windowWorkspace.theme);
|
||||
|
||||
if (!skipUpdate) {
|
||||
for (const dot of browser.gZenThemePicker.panel.querySelectorAll('.zen-theme-picker-dot')) {
|
||||
for (const dot of browser.gZenThemePicker.panel.querySelectorAll(
|
||||
'.zen-theme-picker-dot'
|
||||
)) {
|
||||
dot.remove();
|
||||
}
|
||||
}
|
||||
@@ -1052,7 +1130,9 @@
|
||||
this._animatingBackground = false;
|
||||
appWrapper.removeAttribute('animating');
|
||||
appWrapper.setAttribute('post-animating', 'true');
|
||||
browser.document.documentElement.style.removeProperty('--zen-main-browser-background-old');
|
||||
browser.document.documentElement.style.removeProperty(
|
||||
'--zen-main-browser-background-old'
|
||||
);
|
||||
setTimeout(() => {
|
||||
// Reactivate the transition after the animation
|
||||
appWrapper.removeAttribute('post-animating');
|
||||
@@ -1061,9 +1141,14 @@
|
||||
});
|
||||
}
|
||||
|
||||
const button = browser.document.getElementById('PanelUI-zen-gradient-generator-color-toggle-algo');
|
||||
const button = browser.document.getElementById(
|
||||
'PanelUI-zen-gradient-generator-color-toggle-algo'
|
||||
);
|
||||
if (browser.gZenThemePicker.useAlgo) {
|
||||
document.l10n.setAttributes(button, `zen-panel-ui-gradient-generator-algo-${browser.gZenThemePicker.useAlgo}`);
|
||||
document.l10n.setAttributes(
|
||||
button,
|
||||
`zen-panel-ui-gradient-generator-algo-${browser.gZenThemePicker.useAlgo}`
|
||||
);
|
||||
} else {
|
||||
button.removeAttribute('data-l10n-id');
|
||||
}
|
||||
@@ -1072,10 +1157,19 @@
|
||||
if (!workspaceTheme || workspaceTheme.type !== 'gradient') {
|
||||
const gradient = browser.gZenThemePicker.getGradient([]);
|
||||
const gradientToolbar = browser.gZenThemePicker.getGradient([], true);
|
||||
browser.document.documentElement.style.setProperty('--zen-main-browser-background', gradient);
|
||||
browser.document.documentElement.style.setProperty('--zen-main-browser-background-toolbar', gradientToolbar);
|
||||
browser.document.documentElement.style.setProperty(
|
||||
'--zen-main-browser-background',
|
||||
gradient
|
||||
);
|
||||
browser.document.documentElement.style.setProperty(
|
||||
'--zen-main-browser-background-toolbar',
|
||||
gradientToolbar
|
||||
);
|
||||
browser.gZenThemePicker.updateNoise(0);
|
||||
browser.document.documentElement.style.setProperty('--zen-primary-color', this.getNativeAccentColor());
|
||||
browser.document.documentElement.style.setProperty(
|
||||
'--zen-primary-color',
|
||||
this.getNativeAccentColor()
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1083,7 +1177,9 @@
|
||||
browser.gZenThemePicker.currentRotation = workspaceTheme.rotation ?? -45;
|
||||
browser.gZenThemePicker.currentTexture = workspaceTheme.texture ?? 0;
|
||||
|
||||
for (const button of browser.document.querySelectorAll('#PanelUI-zen-gradient-generator-color-actions button')) {
|
||||
for (const button of browser.document.querySelectorAll(
|
||||
'#PanelUI-zen-gradient-generator-color-actions button'
|
||||
)) {
|
||||
// disable if there are no buttons
|
||||
button.disabled =
|
||||
workspaceTheme.gradientColors.length === 0 ||
|
||||
@@ -1097,7 +1193,9 @@
|
||||
|
||||
browser.document.getElementById('PanelUI-zen-gradient-generator-opacity').value =
|
||||
browser.gZenThemePicker.currentOpacity;
|
||||
const textureSelectWrapper = browser.document.getElementById('PanelUI-zen-gradient-generator-texture-wrapper');
|
||||
const textureSelectWrapper = browser.document.getElementById(
|
||||
'PanelUI-zen-gradient-generator-texture-wrapper'
|
||||
);
|
||||
const textureWrapperWidth = textureSelectWrapper.getBoundingClientRect().width;
|
||||
// Dont show when hidden
|
||||
if (textureWrapperWidth) {
|
||||
@@ -1125,8 +1223,12 @@
|
||||
}
|
||||
|
||||
const numberOfColors = workspaceTheme.gradientColors?.length;
|
||||
const rotationDot = browser.document.getElementById('PanelUI-zen-gradient-generator-rotation-dot');
|
||||
const rotationLine = browser.document.getElementById('PanelUI-zen-gradient-generator-rotation-line');
|
||||
const rotationDot = browser.document.getElementById(
|
||||
'PanelUI-zen-gradient-generator-rotation-dot'
|
||||
);
|
||||
const rotationLine = browser.document.getElementById(
|
||||
'PanelUI-zen-gradient-generator-rotation-line'
|
||||
);
|
||||
if (numberOfColors > 1) {
|
||||
rotationDot.style.opacity = 1;
|
||||
rotationLine.style.opacity = 1;
|
||||
@@ -1136,9 +1238,11 @@
|
||||
const rotationDotPosition = this.currentRotation;
|
||||
const rotationDotWidth = 30;
|
||||
const rotationDotX =
|
||||
Math.cos((rotationDotPosition * Math.PI) / 180) * (rotationParentWidth / 2 - rotationDotWidth / 2);
|
||||
Math.cos((rotationDotPosition * Math.PI) / 180) *
|
||||
(rotationParentWidth / 2 - rotationDotWidth / 2);
|
||||
const rotationDotY =
|
||||
Math.sin((rotationDotPosition * Math.PI) / 180) * (rotationParentWidth / 2 - rotationDotWidth / 2);
|
||||
Math.sin((rotationDotPosition * Math.PI) / 180) *
|
||||
(rotationParentWidth / 2 - rotationDotWidth / 2);
|
||||
rotationDot.style.left = `${rotationParentWidth / 2 + rotationDotX - rotationPadding + rotationDotWidth / 4}px`;
|
||||
rotationDot.style.top = `${rotationParentWidth / 2 + rotationDotY - rotationPadding + rotationDotWidth / 4}px`;
|
||||
} else {
|
||||
@@ -1149,7 +1253,10 @@
|
||||
}
|
||||
|
||||
const gradient = browser.gZenThemePicker.getGradient(workspaceTheme.gradientColors);
|
||||
const gradientToolbar = browser.gZenThemePicker.getGradient(workspaceTheme.gradientColors, true);
|
||||
const gradientToolbar = browser.gZenThemePicker.getGradient(
|
||||
workspaceTheme.gradientColors,
|
||||
true
|
||||
);
|
||||
browser.gZenThemePicker.updateNoise(workspaceTheme.texture);
|
||||
|
||||
for (const dot of workspaceTheme.gradientColors) {
|
||||
@@ -1158,8 +1265,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
browser.document.documentElement.style.setProperty('--zen-main-browser-background-toolbar', gradientToolbar);
|
||||
browser.document.documentElement.style.setProperty('--zen-main-browser-background', gradient);
|
||||
browser.document.documentElement.style.setProperty(
|
||||
'--zen-main-browser-background-toolbar',
|
||||
gradientToolbar
|
||||
);
|
||||
browser.document.documentElement.style.setProperty(
|
||||
'--zen-main-browser-background',
|
||||
gradient
|
||||
);
|
||||
|
||||
const dominantColor = this.getMostDominantColor(workspaceTheme.gradientColors);
|
||||
if (dominantColor) {
|
||||
@@ -1180,7 +1293,10 @@
|
||||
|
||||
fixTheme(theme) {
|
||||
// add a primary color if there isn't one
|
||||
if (!theme.gradientColors.find((color) => color.isPrimary) && theme.gradientColors.length > 0) {
|
||||
if (
|
||||
!theme.gradientColors.find((color) => color.isPrimary) &&
|
||||
theme.gradientColors.length > 0
|
||||
) {
|
||||
theme.gradientColors[(theme.gradientColors.length / 2) | 0].isPrimary = true;
|
||||
}
|
||||
return theme;
|
||||
@@ -1252,9 +1368,19 @@
|
||||
}
|
||||
const isCustom = dot.classList.contains('custom');
|
||||
const algorithm = this.useAlgo;
|
||||
return { c: isCustom ? color : color.match(/\d+/g).map(Number), isCustom, algorithm, isPrimary };
|
||||
return {
|
||||
c: isCustom ? color : color.match(/\d+/g).map(Number),
|
||||
isCustom,
|
||||
algorithm,
|
||||
isPrimary,
|
||||
};
|
||||
});
|
||||
const gradient = ZenThemePicker.getTheme(colors, this.currentOpacity, this.currentRotation, this.currentTexture);
|
||||
const gradient = ZenThemePicker.getTheme(
|
||||
colors,
|
||||
this.currentOpacity,
|
||||
this.currentRotation,
|
||||
this.currentTexture
|
||||
);
|
||||
let currentWorkspace = await ZenWorkspaces.getActiveWorkspace();
|
||||
|
||||
if (!skipSave) {
|
||||
|
||||
@@ -48,7 +48,11 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
`;
|
||||
|
||||
async waitForPromises() {
|
||||
await Promise.all([this.promiseDBInitialized, this.promisePinnedInitialized, SessionStore.promiseAllWindowsRestored]);
|
||||
await Promise.all([
|
||||
this.promiseDBInitialized,
|
||||
this.promisePinnedInitialized,
|
||||
SessionStore.promiseAllWindowsRestored,
|
||||
]);
|
||||
}
|
||||
|
||||
async init() {
|
||||
@@ -64,15 +68,32 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
|
||||
if (!this.shouldHaveWorkspaces) {
|
||||
this._resolveInitialized();
|
||||
document.getElementById('zen-current-workspace-indicator-container').setAttribute('hidden', 'true');
|
||||
document
|
||||
.getElementById('zen-current-workspace-indicator-container')
|
||||
.setAttribute('hidden', 'true');
|
||||
console.warn('ZenWorkspaces: !!! ZenWorkspaces is disabled in hidden windows !!!');
|
||||
return; // We are in a hidden window, don't initialize ZenWorkspaces
|
||||
}
|
||||
|
||||
this.ownerWindow = window;
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, 'activationMethod', 'zen.workspaces.scroll-modifier-key', 'ctrl');
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, 'naturalScroll', 'zen.workspaces.natural-scroll', true);
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, 'shouldWrapAroundNavigation', 'zen.workspaces.wrap-around-navigation', true);
|
||||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
this,
|
||||
'activationMethod',
|
||||
'zen.workspaces.scroll-modifier-key',
|
||||
'ctrl'
|
||||
);
|
||||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
this,
|
||||
'naturalScroll',
|
||||
'zen.workspaces.natural-scroll',
|
||||
true
|
||||
);
|
||||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
this,
|
||||
'shouldWrapAroundNavigation',
|
||||
'zen.workspaces.wrap-around-navigation',
|
||||
true
|
||||
);
|
||||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
this,
|
||||
'shouldForceContainerTabsToWorkspace',
|
||||
@@ -89,7 +110,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
'zen.workspaces.container-specific-essentials-enabled',
|
||||
false
|
||||
);
|
||||
ChromeUtils.defineLazyGetter(this, 'tabContainer', () => document.getElementById('tabbrowser-tabs'));
|
||||
ChromeUtils.defineLazyGetter(this, 'tabContainer', () =>
|
||||
document.getElementById('tabbrowser-tabs')
|
||||
);
|
||||
this._activeWorkspace = Services.prefs.getStringPref('zen.workspaces.active', '');
|
||||
|
||||
window.addEventListener('resize', this.onWindowResize.bind(this));
|
||||
@@ -111,7 +134,10 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
this.log('ZenWorkspaces initialized');
|
||||
|
||||
await this.initializeWorkspaces();
|
||||
if (Services.prefs.getBoolPref('zen.workspaces.swipe-actions', false) && this.workspaceEnabled) {
|
||||
if (
|
||||
Services.prefs.getBoolPref('zen.workspaces.swipe-actions', false) &&
|
||||
this.workspaceEnabled
|
||||
) {
|
||||
this.initializeGestureHandlers();
|
||||
this.initializeWorkspaceNavigation();
|
||||
}
|
||||
@@ -158,7 +184,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
const timeSinceLastSelection = now - this._tabSelectionState.lastSelectionTime;
|
||||
|
||||
if (timeSinceLastSelection < this._tabSelectionState.debounceTime) {
|
||||
await new Promise((resolve) => setTimeout(resolve, this._tabSelectionState.debounceTime - timeSinceLastSelection));
|
||||
await new Promise((resolve) =>
|
||||
setTimeout(resolve, this._tabSelectionState.debounceTime - timeSinceLastSelection)
|
||||
);
|
||||
}
|
||||
|
||||
// Mark selection as in progress
|
||||
@@ -278,7 +306,11 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
}
|
||||
|
||||
_initializeEmptyTab() {
|
||||
this._emptyTab = gBrowser.addTrustedTab('about:blank', { inBackground: true, userContextId: 0, _forZenEmptyTab: true });
|
||||
this._emptyTab = gBrowser.addTrustedTab('about:blank', {
|
||||
inBackground: true,
|
||||
userContextId: 0,
|
||||
_forZenEmptyTab: true,
|
||||
});
|
||||
}
|
||||
|
||||
registerPinnedResizeObserver() {
|
||||
@@ -377,7 +409,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
if (!this.containerSpecificEssentials) {
|
||||
container = 0;
|
||||
}
|
||||
let essentialsContainer = document.querySelector(`.zen-essentials-container[container="${container}"]:not([cloned])`);
|
||||
let essentialsContainer = document.querySelector(
|
||||
`.zen-essentials-container[container="${container}"]:not([cloned])`
|
||||
);
|
||||
if (!essentialsContainer) {
|
||||
essentialsContainer = document.createXULElement('hbox');
|
||||
essentialsContainer.className = 'zen-essentials-container zen-workspace-tabs-section';
|
||||
@@ -421,13 +455,19 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
|
||||
const workspaceIndicator = this.#createWorkspaceSection(workspace);
|
||||
workspaceIndicator.classList.add('zen-current-workspace-indicator');
|
||||
workspaceIndicator.appendChild(window.MozXULElement.parseXULToFragment(this.workspaceIndicatorXUL));
|
||||
document.getElementById('zen-current-workspace-indicator-container').appendChild(workspaceIndicator);
|
||||
workspaceIndicator.appendChild(
|
||||
window.MozXULElement.parseXULToFragment(this.workspaceIndicatorXUL)
|
||||
);
|
||||
document
|
||||
.getElementById('zen-current-workspace-indicator-container')
|
||||
.appendChild(workspaceIndicator);
|
||||
this.initIndicatorContextMenu(workspaceIndicator);
|
||||
}
|
||||
|
||||
_organizeTabsToWorkspaceSections(workspace, section, pinnedSection, tabs) {
|
||||
const workspaceTabs = Array.from(tabs).filter((tab) => tab.getAttribute('zen-workspace-id') === workspace.uuid);
|
||||
const workspaceTabs = Array.from(tabs).filter(
|
||||
(tab) => tab.getAttribute('zen-workspace-id') === workspace.uuid
|
||||
);
|
||||
let firstNormalTab = null;
|
||||
for (let tab of workspaceTabs) {
|
||||
if (tab.hasAttribute('zen-essential')) {
|
||||
@@ -521,7 +561,10 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
meta: event.metaKey,
|
||||
};
|
||||
|
||||
if (this.activationMethod in activationKeyMap && !activationKeyMap[this.activationMethod]) {
|
||||
if (
|
||||
this.activationMethod in activationKeyMap &&
|
||||
!activationKeyMap[this.activationMethod]
|
||||
) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -699,7 +742,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
|
||||
get workspaceEnabled() {
|
||||
if (typeof this._workspaceEnabled === 'undefined') {
|
||||
this._workspaceEnabled = this.shouldHaveWorkspaces && !Services.prefs.getBoolPref('zen.testing.profiling.enabled', false);
|
||||
this._workspaceEnabled =
|
||||
this.shouldHaveWorkspaces &&
|
||||
!Services.prefs.getBoolPref('zen.testing.profiling.enabled', false);
|
||||
}
|
||||
return this._workspaceEnabled && !window.closed;
|
||||
}
|
||||
@@ -741,7 +786,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
this.activeWorkspace = this._workspaceCache.workspaces[0]?.uuid;
|
||||
}
|
||||
// sort by position
|
||||
this._workspaceCache.workspaces.sort((a, b) => (a.position ?? Infinity) - (b.position ?? Infinity));
|
||||
this._workspaceCache.workspaces.sort(
|
||||
(a, b) => (a.position ?? Infinity) - (b.position ?? Infinity)
|
||||
);
|
||||
|
||||
return this._workspaceCache;
|
||||
}
|
||||
@@ -811,7 +858,10 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
};
|
||||
|
||||
let removedEmptyTab = false;
|
||||
if (this._initialTab && !(this._initialTab._shouldRemove && this._initialTab._veryPossiblyEmpty)) {
|
||||
if (
|
||||
this._initialTab &&
|
||||
!(this._initialTab._shouldRemove && this._initialTab._veryPossiblyEmpty)
|
||||
) {
|
||||
gBrowser.selectedTab = this._initialTab;
|
||||
this.moveTabToWorkspace(this._initialTab, this.activeWorkspace);
|
||||
gBrowser.moveTabTo(this._initialTab, { forceUngrouped: true, tabIndex: 0 });
|
||||
@@ -820,7 +870,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
}
|
||||
|
||||
if (this._tabToRemoveForEmpty && !removedEmptyTab) {
|
||||
const tabs = gBrowser.tabs.filter((tab) => !tab.collapsed && !tab.hasAttribute('zen-empty-tab'));
|
||||
const tabs = gBrowser.tabs.filter(
|
||||
(tab) => !tab.collapsed && !tab.hasAttribute('zen-empty-tab')
|
||||
);
|
||||
if (
|
||||
typeof this._tabToSelect === 'number' &&
|
||||
this._tabToSelect >= 0 &&
|
||||
@@ -866,6 +918,26 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
if (gZenVerticalTabsManager._canReplaceNewTab && showed) {
|
||||
BrowserCommands.openTab();
|
||||
}
|
||||
|
||||
if (
|
||||
!gZenVerticalTabsManager._canReplaceNewTab &&
|
||||
!Services.prefs.getBoolPref('zen.workspaces.continue-where-left-off')
|
||||
) {
|
||||
// Go through each tab and see if there's another tab with the same startup URL.
|
||||
// If we do find one, remove it.
|
||||
const newTabUrl = Services.prefs.getStringPref('browser.startup.homepage');
|
||||
const tabs = gBrowser.tabs.filter(
|
||||
(tab) => !tab.collapsed && !tab.hasAttribute('zen-empty-tab') && !tab.pinned
|
||||
);
|
||||
for (const tab of tabs) {
|
||||
if (tab._originalUrl === newTabUrl && tab !== gBrowser.selectedTab) {
|
||||
gBrowser.removeTab(tab, {
|
||||
skipSessionStore: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
window.dispatchEvent(new CustomEvent('AfterWorkspacesSessionRestore', { bubbles: true }));
|
||||
}
|
||||
|
||||
@@ -893,7 +965,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
}
|
||||
|
||||
shouldCloseWindow() {
|
||||
return !window.toolbar.visible || Services.prefs.getBoolPref('browser.tabs.closeWindowWithLastTab');
|
||||
return (
|
||||
!window.toolbar.visible || Services.prefs.getBoolPref('browser.tabs.closeWindowWithLastTab')
|
||||
);
|
||||
}
|
||||
|
||||
async _clearAnyZombieTabs() {
|
||||
@@ -927,7 +1001,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
}
|
||||
|
||||
let tabs = gBrowser.visibleTabs;
|
||||
let tabsPinned = tabs.filter((t) => !this.shouldOpenNewTabIfLastUnpinnedTabIsClosed || !t.pinned);
|
||||
let tabsPinned = tabs.filter(
|
||||
(t) => !this.shouldOpenNewTabIfLastUnpinnedTabIsClosed || !t.pinned
|
||||
);
|
||||
const shouldCloseWindow = this.shouldCloseWindow() && closeWindowWithLastTab;
|
||||
if (tabs.length === 1 && tabs[0] === tab) {
|
||||
if (shouldCloseWindow) {
|
||||
@@ -1172,15 +1248,21 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
async removeWorkspace(windowID) {
|
||||
let workspacesData = await this._workspaces();
|
||||
this._deleteAllTabsInWorkspace(windowID);
|
||||
await this.changeWorkspace(workspacesData.workspaces.find((workspace) => workspace.uuid !== windowID));
|
||||
await this.changeWorkspace(
|
||||
workspacesData.workspaces.find((workspace) => workspace.uuid !== windowID)
|
||||
);
|
||||
delete this._lastSelectedWorkspaceTabs[windowID];
|
||||
await ZenWorkspacesStorage.removeWorkspace(windowID);
|
||||
// Remove the workspace from the cache
|
||||
this._workspaceCache.workspaces = this._workspaceCache.workspaces.filter((workspace) => workspace.uuid !== windowID);
|
||||
this._workspaceCache.workspaces = this._workspaceCache.workspaces.filter(
|
||||
(workspace) => workspace.uuid !== windowID
|
||||
);
|
||||
await this._propagateWorkspaceData();
|
||||
await this._updateWorkspacesChangeContextMenu();
|
||||
this.onWindowResize();
|
||||
for (let container of document.querySelectorAll(`.zen-workspace-tabs-section[zen-workspace-id="${windowID}"]`)) {
|
||||
for (let container of document.querySelectorAll(
|
||||
`.zen-workspace-tabs-section[zen-workspace-id="${windowID}"]`
|
||||
)) {
|
||||
container.remove();
|
||||
}
|
||||
this.registerPinnedResizeObserver();
|
||||
@@ -1192,7 +1274,10 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
|
||||
async getActiveWorkspace() {
|
||||
const workspaces = await this._workspaces();
|
||||
return workspaces.workspaces.find((workspace) => workspace.uuid === this.activeWorkspace) ?? workspaces.workspaces[0];
|
||||
return (
|
||||
workspaces.workspaces.find((workspace) => workspace.uuid === this.activeWorkspace) ??
|
||||
workspaces.workspaces[0]
|
||||
);
|
||||
}
|
||||
// Workspaces dialog UI management
|
||||
|
||||
@@ -1204,13 +1289,15 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
this._workspaceCreateInput.textContent = '';
|
||||
this._workspaceCreateInput.value = '';
|
||||
this._workspaceCreateInput.setAttribute('data-initial-value', '');
|
||||
document.querySelectorAll('#PanelUI-zen-workspaces-icon-picker-wrapper toolbarbutton').forEach((button) => {
|
||||
if (button.label === icon) {
|
||||
button.setAttribute('selected', 'true');
|
||||
} else {
|
||||
button.removeAttribute('selected');
|
||||
}
|
||||
});
|
||||
document
|
||||
.querySelectorAll('#PanelUI-zen-workspaces-icon-picker-wrapper toolbarbutton')
|
||||
.forEach((button) => {
|
||||
if (button.label === icon) {
|
||||
button.setAttribute('selected', 'true');
|
||||
} else {
|
||||
button.removeAttribute('selected');
|
||||
}
|
||||
});
|
||||
document.querySelector('.PanelUI-zen-workspaces-icons-container.create').textContent = icon;
|
||||
|
||||
PanelUI.showSubView('PanelUI-zen-workspaces-create', parentPanel);
|
||||
@@ -1229,14 +1316,17 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
this.onWorkspaceIconChangeInner('edit', ...args);
|
||||
this.onWorkspaceEditChange(...args);
|
||||
};
|
||||
document.querySelectorAll('#PanelUI-zen-workspaces-icon-picker-wrapper toolbarbutton').forEach((button) => {
|
||||
if (button.label === workspaceData.icon) {
|
||||
button.setAttribute('selected', 'true');
|
||||
} else {
|
||||
button.removeAttribute('selected');
|
||||
}
|
||||
});
|
||||
document.querySelector('.PanelUI-zen-workspaces-icons-container.edit').textContent = this.getWorkspaceIcon(workspaceData);
|
||||
document
|
||||
.querySelectorAll('#PanelUI-zen-workspaces-icon-picker-wrapper toolbarbutton')
|
||||
.forEach((button) => {
|
||||
if (button.label === workspaceData.icon) {
|
||||
button.setAttribute('selected', 'true');
|
||||
} else {
|
||||
button.removeAttribute('selected');
|
||||
}
|
||||
});
|
||||
document.querySelector('.PanelUI-zen-workspaces-icons-container.edit').textContent =
|
||||
this.getWorkspaceIcon(workspaceData);
|
||||
let parentPanel = document.getElementById('PanelUI-zen-workspaces-multiview');
|
||||
PanelUI.showSubView('PanelUI-zen-workspaces-edit', parentPanel);
|
||||
}
|
||||
@@ -1283,7 +1373,8 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
|
||||
get shouldShowContainers() {
|
||||
return (
|
||||
Services.prefs.getBoolPref('privacy.userContext.ui.enabled') && ContextualIdentityService.getPublicIdentities().length > 0
|
||||
Services.prefs.getBoolPref('privacy.userContext.ui.enabled') &&
|
||||
ContextualIdentityService.getPublicIdentities().length > 0
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1420,19 +1511,21 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
`);
|
||||
|
||||
// use text content instead of innerHTML to avoid XSS
|
||||
childs.querySelector('.zen-workspace-icon').textContent = browser.ZenWorkspaces.getWorkspaceIcon(workspace);
|
||||
childs.querySelector('.zen-workspace-icon').textContent =
|
||||
browser.ZenWorkspaces.getWorkspaceIcon(workspace);
|
||||
childs.querySelector('.zen-workspace-name').textContent = workspace.name;
|
||||
if (containerGroup) {
|
||||
childs.querySelector('.zen-workspace-container').textContent = ContextualIdentityService.getUserContextLabel(
|
||||
containerGroup.userContextId
|
||||
);
|
||||
childs.querySelector('.zen-workspace-container').textContent =
|
||||
ContextualIdentityService.getUserContextLabel(containerGroup.userContextId);
|
||||
}
|
||||
|
||||
childs.querySelector('.zen-workspace-actions').addEventListener(
|
||||
'command',
|
||||
((event) => {
|
||||
let button = event.target;
|
||||
this._contextMenuId = button.closest('toolbarbutton[zen-workspace-id]').getAttribute('zen-workspace-id');
|
||||
this._contextMenuId = button
|
||||
.closest('toolbarbutton[zen-workspace-id]')
|
||||
.getAttribute('zen-workspace-id');
|
||||
const popup = button.ownerDocument.getElementById('zenWorkspaceActionsMenu');
|
||||
popup.openPopup(button, 'after_end');
|
||||
}).bind(browser.ZenWorkspaces)
|
||||
@@ -1562,7 +1655,11 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
}
|
||||
|
||||
isReorderModeOn(browser) {
|
||||
return browser.document.getElementById('PanelUI-zen-workspaces-list').getAttribute('reorder-mode') === 'true';
|
||||
return (
|
||||
browser.document
|
||||
.getElementById('PanelUI-zen-workspaces-list')
|
||||
.getAttribute('reorder-mode') === 'true'
|
||||
);
|
||||
}
|
||||
|
||||
toggleReorderMode() {
|
||||
@@ -1605,7 +1702,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
if (!this.workspaceEnabled) {
|
||||
return;
|
||||
}
|
||||
let target = event.target.closest('.zen-current-workspace-indicator') || document.getElementById('zen-workspaces-button');
|
||||
let target =
|
||||
event.target.closest('.zen-current-workspace-indicator') ||
|
||||
document.getElementById('zen-workspaces-button');
|
||||
let panel = document.getElementById('PanelUI-zen-workspaces');
|
||||
await this._propagateWorkspaceData({
|
||||
ignoreStrip: true,
|
||||
@@ -1692,7 +1791,10 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
event.stopPropagation();
|
||||
this.openWorkspacesDialog(event);
|
||||
};
|
||||
button.addEventListener('contextmenu', this._workspaceButtonContextMenuListener.bind(browser.ZenWorkspaces));
|
||||
button.addEventListener(
|
||||
'contextmenu',
|
||||
this._workspaceButtonContextMenuListener.bind(browser.ZenWorkspaces)
|
||||
);
|
||||
}
|
||||
|
||||
closeWorkspacesSubView() {
|
||||
@@ -1721,7 +1823,8 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
_deleteAllTabsInWorkspace(workspaceID) {
|
||||
gBrowser.removeTabs(
|
||||
Array.from(this.allStoredTabs).filter(
|
||||
(tab) => tab.getAttribute('zen-workspace-id') === workspaceID && !tab.hasAttribute('zen-empty-tab')
|
||||
(tab) =>
|
||||
tab.getAttribute('zen-workspace-id') === workspaceID && !tab.hasAttribute('zen-empty-tab')
|
||||
),
|
||||
{
|
||||
animate: false,
|
||||
@@ -1737,8 +1840,12 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
|
||||
moveTabsToWorkspace(tabs, workspaceID, justChangeId = false) {
|
||||
for (let tab of tabs) {
|
||||
const parent = tab.pinned ? '#vertical-pinned-tabs-container ' : '#tabbrowser-arrowscrollbox ';
|
||||
const container = document.querySelector(parent + `.zen-workspace-tabs-section[zen-workspace-id="${workspaceID}"]`);
|
||||
const parent = tab.pinned
|
||||
? '#vertical-pinned-tabs-container '
|
||||
: '#tabbrowser-arrowscrollbox ';
|
||||
const container = document.querySelector(
|
||||
parent + `.zen-workspace-tabs-section[zen-workspace-id="${workspaceID}"]`
|
||||
);
|
||||
|
||||
if (container?.contains(tab)) {
|
||||
continue;
|
||||
@@ -1857,7 +1964,10 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
this._animateTabs(this.getActiveWorkspaceFromCache(), true);
|
||||
}
|
||||
|
||||
async _performWorkspaceChange(workspace, { 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 = workspace.uuid;
|
||||
@@ -1869,7 +1979,8 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
const workspaces = await this._workspaces();
|
||||
|
||||
// Refresh tab cache
|
||||
gBrowser.verticalPinnedTabsContainer = this.pinnedTabsContainer || gBrowser.verticalPinnedTabsContainer;
|
||||
gBrowser.verticalPinnedTabsContainer =
|
||||
this.pinnedTabsContainer || gBrowser.verticalPinnedTabsContainer;
|
||||
gBrowser.tabContainer.verticalPinnedTabsContainer =
|
||||
this.pinnedTabsContainer || gBrowser.tabContainer.verticalPinnedTabsContainer;
|
||||
// Move empty tab to the new workspace
|
||||
@@ -1886,8 +1997,13 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
gBrowser.warmupTab(tabToSelect);
|
||||
|
||||
// Update UI and state
|
||||
const previousWorkspaceIndex = workspaces.workspaces.findIndex((w) => w.uuid === previousWorkspace.uuid);
|
||||
await this._updateWorkspaceState(workspace, onInit, tabToSelect, { previousWorkspaceIndex, previousWorkspace });
|
||||
const previousWorkspaceIndex = workspaces.workspaces.findIndex(
|
||||
(w) => w.uuid === previousWorkspace.uuid
|
||||
);
|
||||
await this._updateWorkspaceState(workspace, onInit, tabToSelect, {
|
||||
previousWorkspaceIndex,
|
||||
previousWorkspace,
|
||||
});
|
||||
}
|
||||
|
||||
_moveEmptyTabToWorkspace(workspaceUuid) {
|
||||
@@ -1921,7 +2037,10 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
forAnimation = false,
|
||||
animateContainer = false
|
||||
) {
|
||||
if (arrowscrollbox && !(this._inChangingWorkspace && !forAnimation && !this._alwaysAnimateMarginTop)) {
|
||||
if (
|
||||
arrowscrollbox &&
|
||||
!(this._inChangingWorkspace && !forAnimation && !this._alwaysAnimateMarginTop)
|
||||
) {
|
||||
delete this._alwaysAnimateMarginTop;
|
||||
const essentialsHeight = essentialContainer.getBoundingClientRect().height;
|
||||
workspaceIndicator.style.marginTop = essentialsHeight + 'px';
|
||||
@@ -1963,12 +2082,17 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
if (!justMove) {
|
||||
this._fixIndicatorsNames(workspaces);
|
||||
}
|
||||
const otherContainersEssentials = document.querySelectorAll(`#zen-essentials-wrapper .zen-workspace-tabs-section`);
|
||||
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;
|
||||
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')) {
|
||||
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);
|
||||
@@ -1989,7 +2113,10 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
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
|
||||
if (container.getAttribute('container') != workspace.containerTabId && this.containerSpecificEssentials) {
|
||||
if (
|
||||
container.getAttribute('container') != workspace.containerTabId &&
|
||||
this.containerSpecificEssentials
|
||||
) {
|
||||
container.setAttribute('hidden', 'true');
|
||||
} else {
|
||||
container.removeAttribute('hidden');
|
||||
@@ -2077,7 +2204,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
}
|
||||
if (shouldAnimate && this.containerSpecificEssentials) {
|
||||
const waitForContainers = [];
|
||||
for (const element of document.querySelectorAll('.zen-workspace-tabs-section.zen-workspace-pinned-tabs-section')) {
|
||||
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);
|
||||
@@ -2089,7 +2218,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
}
|
||||
const existingTransform = element.style.transform;
|
||||
const elementWorkspaceId = element.getAttribute('zen-workspace-id');
|
||||
const elementWorkspaceIndex = workspaces.workspaces.findIndex((w) => w.uuid === elementWorkspaceId);
|
||||
const elementWorkspaceIndex = workspaces.workspaces.findIndex(
|
||||
(w) => w.uuid === elementWorkspaceId
|
||||
);
|
||||
const offset = -(newWorkspaceIndex - elementWorkspaceIndex) * 100;
|
||||
const newTransform = `translateX(${offset}%)`;
|
||||
if (shouldAnimate) {
|
||||
@@ -2143,7 +2274,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
// will slide in from the right
|
||||
|
||||
// Get the index from first and last workspace
|
||||
const firstWorkspaceIndex = workspaces.workspaces.findIndex((w) => w.uuid === essentialsWorkspaces[0].uuid);
|
||||
const firstWorkspaceIndex = workspaces.workspaces.findIndex(
|
||||
(w) => w.uuid === essentialsWorkspaces[0].uuid
|
||||
);
|
||||
const lastWorkspaceIndex = workspaces.workspaces.findIndex(
|
||||
(w) => w.uuid === essentialsWorkspaces[essentialsWorkspaces.length - 1].uuid
|
||||
);
|
||||
@@ -2156,7 +2289,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
container.remove();
|
||||
continue;
|
||||
}
|
||||
let stepsInBetween = Math.abs(newWorkspaceIndex - (isGoingLeft ? firstWorkspaceIndex : lastWorkspaceIndex)) + 1;
|
||||
let stepsInBetween =
|
||||
Math.abs(newWorkspaceIndex - (isGoingLeft ? firstWorkspaceIndex : lastWorkspaceIndex)) +
|
||||
1;
|
||||
const usingSameContainer =
|
||||
newWorkspaceEssentialsContainer.workspaces.some((w) => w.uuid === newWorkspace.uuid) &&
|
||||
newWorkspaceEssentialsContainer.workspaces.some((w) => w.uuid === previousWorkspace.uuid);
|
||||
@@ -2185,7 +2320,8 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
existingOffset = 0;
|
||||
}
|
||||
|
||||
const needsOffsetAdjustment = stepsInBetween > essentialsWorkspaces.length || usingSameContainer;
|
||||
const needsOffsetAdjustment =
|
||||
stepsInBetween > essentialsWorkspaces.length || usingSameContainer;
|
||||
|
||||
if (repeats > 0 && needsOffsetAdjustment) {
|
||||
if (!isGoingLeft) {
|
||||
@@ -2211,7 +2347,8 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
if (
|
||||
!usingSameContainer &&
|
||||
isGoingLeft &&
|
||||
(firstWorkspaceIndex === newWorkspaceIndex - 1 || firstWorkspaceIndex === newWorkspaceIndex)
|
||||
(firstWorkspaceIndex === newWorkspaceIndex - 1 ||
|
||||
firstWorkspaceIndex === newWorkspaceIndex)
|
||||
) {
|
||||
existingOffset = -100;
|
||||
newOffset = 0;
|
||||
@@ -2234,7 +2371,10 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
gZenUIManager.motion.animate(
|
||||
container,
|
||||
{
|
||||
transform: [existingTransform, new Array(stepsInBetween).fill(newTransform).join(',')],
|
||||
transform: [
|
||||
existingTransform,
|
||||
new Array(stepsInBetween).fill(newTransform).join(','),
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'spring',
|
||||
@@ -2267,12 +2407,20 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
}
|
||||
|
||||
_shouldChangeToTab(aTab) {
|
||||
return !(aTab?.hasAttribute('zen-essential') || (aTab?.pinned && aTab?.hasAttribute('pending')));
|
||||
return !(
|
||||
aTab?.hasAttribute('zen-essential') ||
|
||||
(aTab?.pinned && aTab?.hasAttribute('pending'))
|
||||
);
|
||||
}
|
||||
|
||||
async #shouldShowTabInCurrentWorkspace(tab) {
|
||||
const currentWorkspace = this.getActiveWorkspaceFromCache();
|
||||
return this._shouldShowTab(tab, currentWorkspace.uuid, currentWorkspace.containerTabId, await this._workspaces());
|
||||
return this._shouldShowTab(
|
||||
tab,
|
||||
currentWorkspace.uuid,
|
||||
currentWorkspace.containerTabId,
|
||||
await this._workspaces()
|
||||
);
|
||||
}
|
||||
|
||||
_shouldShowTab(tab, workspaceUuid, containerId, workspaces) {
|
||||
@@ -2299,7 +2447,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
return (
|
||||
!tabContextId ||
|
||||
tabContextId === '0' ||
|
||||
!workspaces.workspaces.some((workspace) => workspace.containerTabId === parseInt(tabContextId, 10))
|
||||
!workspaces.workspaces.some(
|
||||
(workspace) => workspace.containerTabId === parseInt(tabContextId, 10)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2325,12 +2475,16 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
|
||||
// Save current tab as last selected for old workspace if it shouldn't be visible in new workspace
|
||||
if (oldWorkspaceId && oldWorkspaceId !== workspace.uuid) {
|
||||
this._lastSelectedWorkspaceTabs[oldWorkspaceId] = gZenGlanceManager.getTabOrGlanceParent(currentSelectedTab);
|
||||
this._lastSelectedWorkspaceTabs[oldWorkspaceId] =
|
||||
gZenGlanceManager.getTabOrGlanceParent(currentSelectedTab);
|
||||
}
|
||||
|
||||
let tabToSelect = null;
|
||||
// Try last selected tab if it is visible
|
||||
if (lastSelectedTab && this._shouldShowTab(lastSelectedTab, workspace.uuid, containerId, workspaces)) {
|
||||
if (
|
||||
lastSelectedTab &&
|
||||
this._shouldShowTab(lastSelectedTab, workspace.uuid, containerId, workspaces)
|
||||
) {
|
||||
tabToSelect = lastSelectedTab;
|
||||
}
|
||||
// Find first suitable tab
|
||||
@@ -2362,7 +2516,12 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
return tabToSelect;
|
||||
}
|
||||
|
||||
async _updateWorkspaceState(workspace, onInit, tabToSelect, { previousWorkspaceIndex, previousWorkspace } = {}) {
|
||||
async _updateWorkspaceState(
|
||||
workspace,
|
||||
onInit,
|
||||
tabToSelect,
|
||||
{ previousWorkspaceIndex, previousWorkspace } = {}
|
||||
) {
|
||||
// Update document state
|
||||
document.documentElement.setAttribute('zen-workspace-id', workspace.uuid);
|
||||
|
||||
@@ -2476,7 +2635,12 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
return window;
|
||||
}
|
||||
|
||||
async createAndSaveWorkspace(name = 'Space', icon = undefined, dontChange = false, containerTabId = 0) {
|
||||
async createAndSaveWorkspace(
|
||||
name = 'Space',
|
||||
icon = undefined,
|
||||
dontChange = false,
|
||||
containerTabId = 0
|
||||
) {
|
||||
if (!this.workspaceEnabled) {
|
||||
return;
|
||||
}
|
||||
@@ -2488,7 +2652,13 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
!child.hasAttribute('zen-empty-tab') &&
|
||||
!child.hasAttribute('zen-essential')
|
||||
);
|
||||
let workspaceData = this._createWorkspaceData(name, icon, extraTabs, !dontChange, containerTabId);
|
||||
let workspaceData = this._createWorkspaceData(
|
||||
name,
|
||||
icon,
|
||||
extraTabs,
|
||||
!dontChange,
|
||||
containerTabId
|
||||
);
|
||||
await this.saveWorkspace(workspaceData, dontChange);
|
||||
if (!dontChange) {
|
||||
this.registerPinnedResizeObserver();
|
||||
@@ -2509,7 +2679,11 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
}
|
||||
// Only animate if it's from an event
|
||||
const animateContainer = target && target instanceof EventTarget;
|
||||
await this.onPinnedTabsResize([{ target: target ?? this.pinnedTabsContainer }], forAnimation, animateContainer);
|
||||
await this.onPinnedTabsResize(
|
||||
[{ target: target ?? this.pinnedTabsContainer }],
|
||||
forAnimation,
|
||||
animateContainer
|
||||
);
|
||||
}
|
||||
|
||||
updateShouldHideSeparator(arrowScrollbox, pinnedContainer) {
|
||||
@@ -2614,7 +2788,10 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
}
|
||||
|
||||
async onLocationChange(browser) {
|
||||
gZenCompactModeManager.sidebar.toggleAttribute('zen-has-empty-tab', gBrowser.selectedTab.hasAttribute('zen-empty-tab'));
|
||||
gZenCompactModeManager.sidebar.toggleAttribute(
|
||||
'zen-has-empty-tab',
|
||||
gBrowser.selectedTab.hasAttribute('zen-empty-tab')
|
||||
);
|
||||
if (!this.workspaceEnabled || this._inChangingWorkspace || this._isClosingWindow) {
|
||||
return;
|
||||
}
|
||||
@@ -2686,8 +2863,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
gBrowser.tabContainer._invalidateCachedTabs();
|
||||
}
|
||||
// Return the number of essentials INSIDE the pinned tabs container so we can correctly change their parent
|
||||
return Array.from(this.pinnedTabsContainer.children).filter((child) => child.getAttribute('zen-essential') === 'true')
|
||||
.length;
|
||||
return Array.from(this.pinnedTabsContainer.children).filter(
|
||||
(child) => child.getAttribute('zen-essential') === 'true'
|
||||
).length;
|
||||
}
|
||||
|
||||
// Context menu management
|
||||
@@ -2696,7 +2874,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
async updateContextMenu(_) {
|
||||
console.assert(this._contextMenuId, 'No context menu ID set');
|
||||
document
|
||||
.querySelector(`#PanelUI-zen-workspaces [zen-workspace-id="${this._contextMenuId}"] .zen-workspace-actions`)
|
||||
.querySelector(
|
||||
`#PanelUI-zen-workspaces [zen-workspace-id="${this._contextMenuId}"] .zen-workspace-actions`
|
||||
)
|
||||
.setAttribute('active', 'true');
|
||||
const workspaces = await this._workspaces();
|
||||
let deleteMenuItem = document.getElementById('context_zenDeleteWorkspace');
|
||||
@@ -2707,13 +2887,17 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
}
|
||||
let openMenuItem = document.getElementById('context_zenOpenWorkspace');
|
||||
if (
|
||||
workspaces.workspaces.find((workspace) => workspace.uuid === this._contextMenuId && this.isWorkspaceActive(workspace))
|
||||
workspaces.workspaces.find(
|
||||
(workspace) => workspace.uuid === this._contextMenuId && this.isWorkspaceActive(workspace)
|
||||
)
|
||||
) {
|
||||
openMenuItem.setAttribute('disabled', 'true');
|
||||
} else {
|
||||
openMenuItem.removeAttribute('disabled');
|
||||
}
|
||||
const openInContainerMenuItem = document.getElementById('context_zenWorkspacesOpenInContainerTab');
|
||||
const openInContainerMenuItem = document.getElementById(
|
||||
'context_zenWorkspacesOpenInContainerTab'
|
||||
);
|
||||
if (this.shouldShowContainers) {
|
||||
openInContainerMenuItem.removeAttribute('hidden');
|
||||
} else {
|
||||
@@ -2724,7 +2908,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
async contextChangeContainerTab(event) {
|
||||
this._organizingWorkspaceStrip = true;
|
||||
let workspaces = await this._workspaces();
|
||||
let workspace = workspaces.workspaces.find((workspace) => workspace.uuid === this._contextMenuId);
|
||||
let workspace = workspaces.workspaces.find(
|
||||
(workspace) => workspace.uuid === this._contextMenuId
|
||||
);
|
||||
let userContextId = parseInt(event.target.getAttribute('data-usercontextid'));
|
||||
workspace.containerTabId = userContextId + 0; // +0 to convert to number
|
||||
await this.saveWorkspace(workspace);
|
||||
@@ -2756,7 +2942,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
|
||||
async openWorkspace() {
|
||||
let workspaces = await this._workspaces();
|
||||
let workspace = workspaces.workspaces.find((workspace) => workspace.uuid === this._contextMenuId);
|
||||
let workspace = workspaces.workspaces.find(
|
||||
(workspace) => workspace.uuid === this._contextMenuId
|
||||
);
|
||||
await this.changeWorkspace(workspace);
|
||||
}
|
||||
|
||||
@@ -2777,7 +2965,10 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
return this._emojis;
|
||||
}
|
||||
const lazy = {};
|
||||
Services.scriptloader.loadSubScript('chrome://browser/content/zen-components/ZenEmojies.mjs', lazy);
|
||||
Services.scriptloader.loadSubScript(
|
||||
'chrome://browser/content/zen-components/ZenEmojies.mjs',
|
||||
lazy
|
||||
);
|
||||
this._emojis = lazy.zenGlobalEmojis();
|
||||
return this._emojis;
|
||||
}
|
||||
@@ -2821,7 +3012,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
}
|
||||
|
||||
async changeTabWorkspace(workspaceID) {
|
||||
const tabs = TabContextMenu.contextTab.multiselected ? gBrowser.selectedTabs : [TabContextMenu.contextTab];
|
||||
const tabs = TabContextMenu.contextTab.multiselected
|
||||
? gBrowser.selectedTabs
|
||||
: [TabContextMenu.contextTab];
|
||||
document.getElementById('tabContextMenu').hidePopup();
|
||||
const previousWorkspaceID = document.documentElement.getAttribute('zen-workspace-id');
|
||||
for (let tab of tabs) {
|
||||
@@ -2833,9 +3026,13 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
}
|
||||
}
|
||||
// Make sure we select the last tab in the new workspace
|
||||
this._lastSelectedWorkspaceTabs[workspaceID] = gZenGlanceManager.getTabOrGlanceParent(tabs[tabs.length - 1]);
|
||||
this._lastSelectedWorkspaceTabs[workspaceID] = gZenGlanceManager.getTabOrGlanceParent(
|
||||
tabs[tabs.length - 1]
|
||||
);
|
||||
const workspaces = await this._workspaces();
|
||||
await this.changeWorkspace(workspaces.workspaces.find((workspace) => workspace.uuid === workspaceID));
|
||||
await this.changeWorkspace(
|
||||
workspaces.workspaces.find((workspace) => workspace.uuid === workspaceID)
|
||||
);
|
||||
}
|
||||
|
||||
// Tab browser utilities
|
||||
@@ -2878,7 +3075,11 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
const activeWorkspace = this.getActiveWorkspaceFromCache();
|
||||
const activeWorkspaceUserContextId = activeWorkspace?.containerTabId;
|
||||
|
||||
if (fromExternal !== true && typeof userContextId !== 'undefined' && userContextId !== activeWorkspaceUserContextId) {
|
||||
if (
|
||||
fromExternal !== true &&
|
||||
typeof userContextId !== 'undefined' &&
|
||||
userContextId !== activeWorkspaceUserContextId
|
||||
) {
|
||||
return [userContextId, false, undefined];
|
||||
}
|
||||
return [activeWorkspaceUserContextId, true, undefined];
|
||||
@@ -2890,7 +3091,10 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
return this.allStoredTabs.filter(
|
||||
(tab) =>
|
||||
tab.getAttribute('zen-workspace-id') !== tabWorkspaceId &&
|
||||
!(this.containerSpecificEssentials && tab.getAttribute('container') !== aTab.getAttribute('container')) &&
|
||||
!(
|
||||
this.containerSpecificEssentials &&
|
||||
tab.getAttribute('container') !== aTab.getAttribute('container')
|
||||
) &&
|
||||
!tab.hasAttribute('zen-empty-tab')
|
||||
);
|
||||
}
|
||||
@@ -2912,7 +3116,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
let isInActiveWorkspace = false;
|
||||
let isInOtherWorkspace = false;
|
||||
|
||||
for (const [workspaceUuid, bookmarkGuids] of Object.entries(this._workspaceBookmarksCache.bookmarks)) {
|
||||
for (const [workspaceUuid, bookmarkGuids] of Object.entries(
|
||||
this._workspaceBookmarksCache.bookmarks
|
||||
)) {
|
||||
if (bookmarkGuids.includes(bookmarkGuid)) {
|
||||
if (workspaceUuid === activeWorkspaceUuid) {
|
||||
isInActiveWorkspace = true;
|
||||
@@ -2934,9 +3140,15 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
|
||||
const tabs = [];
|
||||
// we need to go through each tab in each container
|
||||
const essentialsContainer = document.querySelectorAll('#zen-essentials-wrapper .zen-workspace-tabs-section');
|
||||
let pinnedContainers = document.querySelectorAll('#vertical-pinned-tabs-container .zen-workspace-tabs-section');
|
||||
let normalContainers = document.querySelectorAll('#tabbrowser-arrowscrollbox .zen-workspace-tabs-section');
|
||||
const essentialsContainer = document.querySelectorAll(
|
||||
'#zen-essentials-wrapper .zen-workspace-tabs-section'
|
||||
);
|
||||
let pinnedContainers = document.querySelectorAll(
|
||||
'#vertical-pinned-tabs-container .zen-workspace-tabs-section'
|
||||
);
|
||||
let normalContainers = document.querySelectorAll(
|
||||
'#tabbrowser-arrowscrollbox .zen-workspace-tabs-section'
|
||||
);
|
||||
if (!this._hasInitializedTabsStrip) {
|
||||
pinnedContainers = [document.getElementById('vertical-pinned-tabs-container')];
|
||||
normalContainers = [this.activeWorkspaceStrip];
|
||||
@@ -2973,8 +3185,12 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
let children = this.tabboxChildren;
|
||||
return children.filter((node) => node.tagName == 'tab-group');
|
||||
}
|
||||
const pinnedContainers = document.querySelectorAll('#vertical-pinned-tabs-container .zen-workspace-tabs-section');
|
||||
const normalContainers = document.querySelectorAll('#tabbrowser-arrowscrollbox .zen-workspace-tabs-section');
|
||||
const pinnedContainers = document.querySelectorAll(
|
||||
'#vertical-pinned-tabs-container .zen-workspace-tabs-section'
|
||||
);
|
||||
const normalContainers = document.querySelectorAll(
|
||||
'#tabbrowser-arrowscrollbox .zen-workspace-tabs-section'
|
||||
);
|
||||
const containers = [...pinnedContainers, ...normalContainers];
|
||||
const tabGroups = [];
|
||||
for (const container of containers) {
|
||||
@@ -2999,7 +3215,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
get allWorkspaceTabs() {
|
||||
const currentWorkspace = this.activeWorkspace;
|
||||
return this.allStoredTabs.filter(
|
||||
(tab) => tab.hasAttribute('zen-essential') || tab.getAttribute('zen-workspace-id') === currentWorkspace
|
||||
(tab) =>
|
||||
tab.hasAttribute('zen-essential') ||
|
||||
tab.getAttribute('zen-workspace-id') === currentWorkspace
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3038,7 +3256,8 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
const currentWorkspace = this.getActiveWorkspaceFromCache();
|
||||
// Check if we need to change workspace
|
||||
if (
|
||||
(tab.getAttribute('zen-workspace-id') !== this.activeWorkspace && !tab.hasAttribute('zen-essential')) ||
|
||||
(tab.getAttribute('zen-workspace-id') !== this.activeWorkspace &&
|
||||
!tab.hasAttribute('zen-essential')) ||
|
||||
(currentWorkspace.containerTabId !== parseInt(tab.parentNode.getAttribute('container')) &&
|
||||
this.containerSpecificEssentials)
|
||||
) {
|
||||
|
||||
@@ -17,9 +17,11 @@ var ZenWorkspacesStorage = {
|
||||
},
|
||||
|
||||
async _ensureTable() {
|
||||
await this.lazy.PlacesUtils.withConnectionWrapper('ZenWorkspacesStorage._ensureTable', async (db) => {
|
||||
// Create the main workspaces table if it doesn't exist
|
||||
await db.execute(`
|
||||
await this.lazy.PlacesUtils.withConnectionWrapper(
|
||||
'ZenWorkspacesStorage._ensureTable',
|
||||
async (db) => {
|
||||
// Create the main workspaces table if it doesn't exist
|
||||
await db.execute(`
|
||||
CREATE TABLE IF NOT EXISTS zen_workspaces (
|
||||
id INTEGER PRIMARY KEY,
|
||||
uuid TEXT UNIQUE NOT NULL,
|
||||
@@ -32,55 +34,60 @@ var ZenWorkspacesStorage = {
|
||||
)
|
||||
`);
|
||||
|
||||
// Add new columns if they don't exist
|
||||
// SQLite doesn't have a direct "ADD COLUMN IF NOT EXISTS" syntax,
|
||||
// so we need to check if the columns exist first
|
||||
const columns = await db.execute(`PRAGMA table_info(zen_workspaces)`);
|
||||
const columnNames = columns.map((row) => row.getResultByName('name'));
|
||||
// Add new columns if they don't exist
|
||||
// SQLite doesn't have a direct "ADD COLUMN IF NOT EXISTS" syntax,
|
||||
// so we need to check if the columns exist first
|
||||
const columns = await db.execute(`PRAGMA table_info(zen_workspaces)`);
|
||||
const columnNames = columns.map((row) => row.getResultByName('name'));
|
||||
|
||||
// Helper function to add column if it doesn't exist
|
||||
const addColumnIfNotExists = async (columnName, definition) => {
|
||||
if (!columnNames.includes(columnName)) {
|
||||
await db.execute(`ALTER TABLE zen_workspaces ADD COLUMN ${columnName} ${definition}`);
|
||||
}
|
||||
};
|
||||
// Helper function to add column if it doesn't exist
|
||||
const addColumnIfNotExists = async (columnName, definition) => {
|
||||
if (!columnNames.includes(columnName)) {
|
||||
await db.execute(`ALTER TABLE zen_workspaces ADD COLUMN ${columnName} ${definition}`);
|
||||
}
|
||||
};
|
||||
|
||||
// Add each new column if it doesn't exist
|
||||
await addColumnIfNotExists('theme_type', 'TEXT');
|
||||
await addColumnIfNotExists('theme_colors', 'TEXT');
|
||||
await addColumnIfNotExists('theme_opacity', 'REAL');
|
||||
await addColumnIfNotExists('theme_rotation', 'INTEGER');
|
||||
await addColumnIfNotExists('theme_texture', 'REAL');
|
||||
// Add each new column if it doesn't exist
|
||||
await addColumnIfNotExists('theme_type', 'TEXT');
|
||||
await addColumnIfNotExists('theme_colors', 'TEXT');
|
||||
await addColumnIfNotExists('theme_opacity', 'REAL');
|
||||
await addColumnIfNotExists('theme_rotation', 'INTEGER');
|
||||
await addColumnIfNotExists('theme_texture', 'REAL');
|
||||
|
||||
// Create an index on the uuid column
|
||||
await db.execute(`
|
||||
// Create an index on the uuid column
|
||||
await db.execute(`
|
||||
CREATE INDEX IF NOT EXISTS idx_zen_workspaces_uuid ON zen_workspaces(uuid)
|
||||
`);
|
||||
|
||||
// Create the changes tracking table if it doesn't exist
|
||||
await db.execute(`
|
||||
// Create the changes tracking table if it doesn't exist
|
||||
await db.execute(`
|
||||
CREATE TABLE IF NOT EXISTS zen_workspaces_changes (
|
||||
uuid TEXT PRIMARY KEY,
|
||||
timestamp INTEGER NOT NULL
|
||||
)
|
||||
`);
|
||||
|
||||
// Create an index on the uuid column for changes tracking table
|
||||
await db.execute(`
|
||||
// Create an index on the uuid column for changes tracking table
|
||||
await db.execute(`
|
||||
CREATE INDEX IF NOT EXISTS idx_zen_workspaces_changes_uuid ON zen_workspaces_changes(uuid)
|
||||
`);
|
||||
|
||||
if (!this.lazy.Weave.Service.engineManager.get('workspaces')) {
|
||||
this.lazy.Weave.Service.engineManager.register(ZenWorkspacesEngine);
|
||||
await ZenWorkspacesStorage.migrateWorkspacesFromJSON();
|
||||
}
|
||||
if (!this.lazy.Weave.Service.engineManager.get('workspaces')) {
|
||||
this.lazy.Weave.Service.engineManager.register(ZenWorkspacesEngine);
|
||||
await ZenWorkspacesStorage.migrateWorkspacesFromJSON();
|
||||
}
|
||||
|
||||
ZenWorkspaces._resolveDBInitialized();
|
||||
});
|
||||
ZenWorkspaces._resolveDBInitialized();
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
async migrateWorkspacesFromJSON() {
|
||||
const oldWorkspacesPath = PathUtils.join(PathUtils.profileDir, 'zen-workspaces', 'Workspaces.json');
|
||||
const oldWorkspacesPath = PathUtils.join(
|
||||
PathUtils.profileDir,
|
||||
'zen-workspaces',
|
||||
'Workspaces.json'
|
||||
);
|
||||
if (await IOUtils.exists(oldWorkspacesPath)) {
|
||||
console.info('ZenWorkspacesStorage: Migrating workspaces from JSON...');
|
||||
const oldWorkspaces = await IOUtils.readJSON(oldWorkspacesPath);
|
||||
@@ -110,23 +117,27 @@ var ZenWorkspacesStorage = {
|
||||
async saveWorkspace(workspace, notifyObservers = true) {
|
||||
const changedUUIDs = new Set();
|
||||
|
||||
await this.lazy.PlacesUtils.withConnectionWrapper('ZenWorkspacesStorage.saveWorkspace', async (db) => {
|
||||
await db.executeTransaction(async () => {
|
||||
const now = Date.now();
|
||||
await this.lazy.PlacesUtils.withConnectionWrapper(
|
||||
'ZenWorkspacesStorage.saveWorkspace',
|
||||
async (db) => {
|
||||
await db.executeTransaction(async () => {
|
||||
const now = Date.now();
|
||||
|
||||
let newPosition;
|
||||
if ('position' in workspace && Number.isFinite(workspace.position)) {
|
||||
newPosition = workspace.position;
|
||||
} else {
|
||||
// Get the maximum position
|
||||
const maxPositionResult = await db.execute(`SELECT MAX("position") as max_position FROM zen_workspaces`);
|
||||
const maxPosition = maxPositionResult[0].getResultByName('max_position') || 0;
|
||||
newPosition = maxPosition + 1000; // Add a large increment to avoid frequent reordering
|
||||
}
|
||||
let newPosition;
|
||||
if ('position' in workspace && Number.isFinite(workspace.position)) {
|
||||
newPosition = workspace.position;
|
||||
} else {
|
||||
// Get the maximum position
|
||||
const maxPositionResult = await db.execute(
|
||||
`SELECT MAX("position") as max_position FROM zen_workspaces`
|
||||
);
|
||||
const maxPosition = maxPositionResult[0].getResultByName('max_position') || 0;
|
||||
newPosition = maxPosition + 1000; // Add a large increment to avoid frequent reordering
|
||||
}
|
||||
|
||||
// Insert or replace the workspace
|
||||
await db.executeCached(
|
||||
`
|
||||
// Insert or replace the workspace
|
||||
await db.executeCached(
|
||||
`
|
||||
INSERT OR REPLACE INTO zen_workspaces (
|
||||
uuid, name, icon, container_id, created_at, updated_at, "position",
|
||||
theme_type, theme_colors, theme_opacity, theme_rotation, theme_texture
|
||||
@@ -138,38 +149,39 @@ var ZenWorkspacesStorage = {
|
||||
:theme_type, :theme_colors, :theme_opacity, :theme_rotation, :theme_texture
|
||||
)
|
||||
`,
|
||||
{
|
||||
uuid: workspace.uuid,
|
||||
name: workspace.name,
|
||||
icon: workspace.icon || null,
|
||||
container_id: workspace.containerTabId || null,
|
||||
now,
|
||||
position: newPosition,
|
||||
theme_type: workspace.theme?.type || null,
|
||||
theme_colors: workspace.theme ? JSON.stringify(workspace.theme.gradientColors) : null,
|
||||
theme_opacity: workspace.theme?.opacity || null,
|
||||
theme_rotation: workspace.theme?.rotation || null,
|
||||
theme_texture: workspace.theme?.texture || null,
|
||||
}
|
||||
);
|
||||
{
|
||||
uuid: workspace.uuid,
|
||||
name: workspace.name,
|
||||
icon: workspace.icon || null,
|
||||
container_id: workspace.containerTabId || null,
|
||||
now,
|
||||
position: newPosition,
|
||||
theme_type: workspace.theme?.type || null,
|
||||
theme_colors: workspace.theme ? JSON.stringify(workspace.theme.gradientColors) : null,
|
||||
theme_opacity: workspace.theme?.opacity || null,
|
||||
theme_rotation: workspace.theme?.rotation || null,
|
||||
theme_texture: workspace.theme?.texture || null,
|
||||
}
|
||||
);
|
||||
|
||||
// Record the change
|
||||
await db.execute(
|
||||
`
|
||||
// Record the change
|
||||
await db.execute(
|
||||
`
|
||||
INSERT OR REPLACE INTO zen_workspaces_changes (uuid, timestamp)
|
||||
VALUES (:uuid, :timestamp)
|
||||
`,
|
||||
{
|
||||
uuid: workspace.uuid,
|
||||
timestamp: Math.floor(now / 1000),
|
||||
}
|
||||
);
|
||||
{
|
||||
uuid: workspace.uuid,
|
||||
timestamp: Math.floor(now / 1000),
|
||||
}
|
||||
);
|
||||
|
||||
changedUUIDs.add(workspace.uuid);
|
||||
changedUUIDs.add(workspace.uuid);
|
||||
|
||||
await this.updateLastChangeTimestamp(db);
|
||||
});
|
||||
});
|
||||
await this.updateLastChangeTimestamp(db);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
if (notifyObservers) {
|
||||
this._notifyWorkspacesChanged('zen-workspace-updated', Array.from(changedUUIDs));
|
||||
@@ -202,29 +214,32 @@ var ZenWorkspacesStorage = {
|
||||
async removeWorkspace(uuid, notifyObservers = true) {
|
||||
const changedUUIDs = [uuid];
|
||||
|
||||
await this.lazy.PlacesUtils.withConnectionWrapper('ZenWorkspacesStorage.removeWorkspace', async (db) => {
|
||||
await db.execute(
|
||||
`
|
||||
await this.lazy.PlacesUtils.withConnectionWrapper(
|
||||
'ZenWorkspacesStorage.removeWorkspace',
|
||||
async (db) => {
|
||||
await db.execute(
|
||||
`
|
||||
DELETE FROM zen_workspaces WHERE uuid = :uuid
|
||||
`,
|
||||
{ uuid }
|
||||
);
|
||||
{ uuid }
|
||||
);
|
||||
|
||||
// Record the removal as a change
|
||||
const now = Date.now();
|
||||
await db.execute(
|
||||
`
|
||||
// Record the removal as a change
|
||||
const now = Date.now();
|
||||
await db.execute(
|
||||
`
|
||||
INSERT OR REPLACE INTO zen_workspaces_changes (uuid, timestamp)
|
||||
VALUES (:uuid, :timestamp)
|
||||
`,
|
||||
{
|
||||
uuid,
|
||||
timestamp: Math.floor(now / 1000),
|
||||
}
|
||||
);
|
||||
{
|
||||
uuid,
|
||||
timestamp: Math.floor(now / 1000),
|
||||
}
|
||||
);
|
||||
|
||||
await this.updateLastChangeTimestamp(db);
|
||||
});
|
||||
await this.updateLastChangeTimestamp(db);
|
||||
}
|
||||
);
|
||||
|
||||
if (notifyObservers) {
|
||||
this._notifyWorkspacesChanged('zen-workspace-removed', changedUUIDs);
|
||||
@@ -232,27 +247,33 @@ var ZenWorkspacesStorage = {
|
||||
},
|
||||
|
||||
async wipeAllWorkspaces() {
|
||||
await this.lazy.PlacesUtils.withConnectionWrapper('ZenWorkspacesStorage.wipeAllWorkspaces', async (db) => {
|
||||
await db.execute(`DELETE FROM zen_workspaces`);
|
||||
await db.execute(`DELETE FROM zen_workspaces_changes`);
|
||||
await this.updateLastChangeTimestamp(db);
|
||||
});
|
||||
await this.lazy.PlacesUtils.withConnectionWrapper(
|
||||
'ZenWorkspacesStorage.wipeAllWorkspaces',
|
||||
async (db) => {
|
||||
await db.execute(`DELETE FROM zen_workspaces`);
|
||||
await db.execute(`DELETE FROM zen_workspaces_changes`);
|
||||
await this.updateLastChangeTimestamp(db);
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
async markChanged(uuid) {
|
||||
await this.lazy.PlacesUtils.withConnectionWrapper('ZenWorkspacesStorage.markChanged', async (db) => {
|
||||
const now = Date.now();
|
||||
await db.execute(
|
||||
`
|
||||
await this.lazy.PlacesUtils.withConnectionWrapper(
|
||||
'ZenWorkspacesStorage.markChanged',
|
||||
async (db) => {
|
||||
const now = Date.now();
|
||||
await db.execute(
|
||||
`
|
||||
INSERT OR REPLACE INTO zen_workspaces_changes (uuid, timestamp)
|
||||
VALUES (:uuid, :timestamp)
|
||||
`,
|
||||
{
|
||||
uuid,
|
||||
timestamp: Math.floor(now / 1000),
|
||||
}
|
||||
);
|
||||
});
|
||||
{
|
||||
uuid,
|
||||
timestamp: Math.floor(now / 1000),
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
async saveWorkspaceTheme(uuid, theme, notifyObservers = true) {
|
||||
@@ -303,14 +324,19 @@ var ZenWorkspacesStorage = {
|
||||
},
|
||||
|
||||
async clearChangedIDs() {
|
||||
await this.lazy.PlacesUtils.withConnectionWrapper('ZenWorkspacesStorage.clearChangedIDs', async (db) => {
|
||||
await db.execute(`DELETE FROM zen_workspaces_changes`);
|
||||
});
|
||||
await this.lazy.PlacesUtils.withConnectionWrapper(
|
||||
'ZenWorkspacesStorage.clearChangedIDs',
|
||||
async (db) => {
|
||||
await db.execute(`DELETE FROM zen_workspaces_changes`);
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
shouldReorderWorkspaces(before, current, after) {
|
||||
const minGap = 1; // Minimum allowed gap between positions
|
||||
return (before !== null && current - before < minGap) || (after !== null && after - current < minGap);
|
||||
return (
|
||||
(before !== null && current - before < minGap) || (after !== null && after - current < minGap)
|
||||
);
|
||||
},
|
||||
|
||||
async reorderAllWorkspaces(db, changedUUIDs) {
|
||||
@@ -356,41 +382,44 @@ var ZenWorkspacesStorage = {
|
||||
async updateWorkspacePositions(workspaces) {
|
||||
const changedUUIDs = new Set();
|
||||
|
||||
await this.lazy.PlacesUtils.withConnectionWrapper('ZenWorkspacesStorage.updateWorkspacePositions', async (db) => {
|
||||
await db.executeTransaction(async () => {
|
||||
const now = Date.now();
|
||||
await this.lazy.PlacesUtils.withConnectionWrapper(
|
||||
'ZenWorkspacesStorage.updateWorkspacePositions',
|
||||
async (db) => {
|
||||
await db.executeTransaction(async () => {
|
||||
const now = Date.now();
|
||||
|
||||
for (let i = 0; i < workspaces.length; i++) {
|
||||
const workspace = workspaces[i];
|
||||
const newPosition = (i + 1) * 1000;
|
||||
for (let i = 0; i < workspaces.length; i++) {
|
||||
const workspace = workspaces[i];
|
||||
const newPosition = (i + 1) * 1000;
|
||||
|
||||
await db.execute(
|
||||
`
|
||||
await db.execute(
|
||||
`
|
||||
UPDATE zen_workspaces
|
||||
SET "position" = :newPosition
|
||||
WHERE uuid = :uuid
|
||||
`,
|
||||
{ newPosition, uuid: workspace.uuid }
|
||||
);
|
||||
{ newPosition, uuid: workspace.uuid }
|
||||
);
|
||||
|
||||
changedUUIDs.add(workspace.uuid);
|
||||
changedUUIDs.add(workspace.uuid);
|
||||
|
||||
// Record the change
|
||||
await db.execute(
|
||||
`
|
||||
// Record the change
|
||||
await db.execute(
|
||||
`
|
||||
INSERT OR REPLACE INTO zen_workspaces_changes (uuid, timestamp)
|
||||
VALUES (:uuid, :timestamp)
|
||||
`,
|
||||
{
|
||||
uuid: workspace.uuid,
|
||||
timestamp: Math.floor(now / 1000),
|
||||
}
|
||||
);
|
||||
}
|
||||
{
|
||||
uuid: workspace.uuid,
|
||||
timestamp: Math.floor(now / 1000),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
await this.updateLastChangeTimestamp(db);
|
||||
});
|
||||
});
|
||||
await this.updateLastChangeTimestamp(db);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
this._notifyWorkspacesChanged('zen-workspace-updated', Array.from(changedUUIDs));
|
||||
},
|
||||
@@ -403,9 +432,11 @@ var ZenWorkspaceBookmarksStorage = {
|
||||
},
|
||||
|
||||
async _ensureTable() {
|
||||
await ZenWorkspacesStorage.lazy.PlacesUtils.withConnectionWrapper('ZenWorkspaceBookmarksStorage.init', async (db) => {
|
||||
// Create table using GUIDs instead of IDs
|
||||
await db.execute(`
|
||||
await ZenWorkspacesStorage.lazy.PlacesUtils.withConnectionWrapper(
|
||||
'ZenWorkspaceBookmarksStorage.init',
|
||||
async (db) => {
|
||||
// Create table using GUIDs instead of IDs
|
||||
await db.execute(`
|
||||
CREATE TABLE IF NOT EXISTS zen_bookmarks_workspaces (
|
||||
id INTEGER PRIMARY KEY,
|
||||
bookmark_guid TEXT NOT NULL,
|
||||
@@ -418,14 +449,14 @@ var ZenWorkspaceBookmarksStorage = {
|
||||
)
|
||||
`);
|
||||
|
||||
// Create index for fast lookups
|
||||
await db.execute(`
|
||||
// Create index for fast lookups
|
||||
await db.execute(`
|
||||
CREATE INDEX IF NOT EXISTS idx_bookmarks_workspaces_lookup
|
||||
ON zen_bookmarks_workspaces(workspace_uuid, bookmark_guid)
|
||||
`);
|
||||
|
||||
// Add changes tracking table
|
||||
await db.execute(`
|
||||
// Add changes tracking table
|
||||
await db.execute(`
|
||||
CREATE TABLE IF NOT EXISTS zen_bookmarks_workspaces_changes (
|
||||
id INTEGER PRIMARY KEY,
|
||||
bookmark_guid TEXT NOT NULL,
|
||||
@@ -438,12 +469,13 @@ var ZenWorkspaceBookmarksStorage = {
|
||||
)
|
||||
`);
|
||||
|
||||
// Create index for changes tracking
|
||||
await db.execute(`
|
||||
// Create index for changes tracking
|
||||
await db.execute(`
|
||||
CREATE INDEX IF NOT EXISTS idx_bookmarks_workspaces_changes
|
||||
ON zen_bookmarks_workspaces_changes(bookmark_guid, workspace_uuid)
|
||||
`);
|
||||
});
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,10 +2,14 @@
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
var { Tracker, Store, SyncEngine } = ChromeUtils.importESModule('resource://services-sync/engines.sys.mjs');
|
||||
var { Tracker, Store, SyncEngine } = ChromeUtils.importESModule(
|
||||
'resource://services-sync/engines.sys.mjs'
|
||||
);
|
||||
var { CryptoWrapper } = ChromeUtils.importESModule('resource://services-sync/record.sys.mjs');
|
||||
var { Utils } = ChromeUtils.importESModule('resource://services-sync/util.sys.mjs');
|
||||
var { SCORE_INCREMENT_XLARGE } = ChromeUtils.importESModule('resource://services-sync/constants.sys.mjs');
|
||||
var { SCORE_INCREMENT_XLARGE } = ChromeUtils.importESModule(
|
||||
'resource://services-sync/constants.sys.mjs'
|
||||
);
|
||||
|
||||
// Define ZenWorkspaceRecord
|
||||
function ZenWorkspaceRecord(collection, id) {
|
||||
|
||||
@@ -202,7 +202,10 @@
|
||||
margin-bottom: 20px;
|
||||
|
||||
background: var(--zen-toolbar-element-bg);
|
||||
background-image: radial-gradient(light-dark(rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.4)) 1px, transparent 0);
|
||||
background-image: radial-gradient(
|
||||
light-dark(rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.4)) 1px,
|
||||
transparent 0
|
||||
);
|
||||
background-position: -19px -19px;
|
||||
background-size: 5px 5px;
|
||||
|
||||
@@ -321,7 +324,11 @@
|
||||
border: 1px solid color-mix(in srgb, var(--zen-colors-border) 50%, transparent 50%);
|
||||
border-radius: 50%;
|
||||
/* 3d effect */
|
||||
background: linear-gradient(-45deg, transparent -10%, light-dark(rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0.1)) 110%);
|
||||
background: linear-gradient(
|
||||
-45deg,
|
||||
transparent -10%,
|
||||
light-dark(rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0.1)) 110%
|
||||
);
|
||||
z-index: 2;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
|
||||
@@ -460,7 +460,8 @@
|
||||
}
|
||||
|
||||
.zen-current-workspace-indicator {
|
||||
padding: calc(15px + var(--zen-toolbox-padding)) calc(4px + var(--tab-inline-padding) + var(--zen-toolbox-padding));
|
||||
padding: calc(15px + var(--zen-toolbox-padding))
|
||||
calc(4px + var(--tab-inline-padding) + var(--zen-toolbox-padding));
|
||||
font-weight: 600;
|
||||
position: absolute;
|
||||
max-height: var(--zen-workspace-indicator-height);
|
||||
|
||||
Reference in New Issue
Block a user