Compare commits

..

4 Commits
1.21.6b ... dev

2 changed files with 20 additions and 36 deletions

View File

@@ -460,16 +460,19 @@ class nsZenWorkspaces {
document
.getElementById("zen-essentials")
.appendChild(essentialsContainer);
// Set an initial hidden state if the essentials section is not supposed
// to be shown on the current workspace
if (
this.containerSpecificEssentials &&
this.getActiveWorkspaceFromCache()?.containerTabId != container
) {
essentialsContainer.setAttribute("hidden", "true");
}
}
// Set a hidden state if the essentials section is not supposed
// to be shown on the current workspace, else remove the hidden state
if (
this.containerSpecificEssentials &&
this.getActiveWorkspaceFromCache()?.containerTabId != container
) {
essentialsContainer.setAttribute("hidden", "true");
} else {
essentialsContainer.removeAttribute("hidden");
}
return essentialsContainer;
}
@@ -1161,6 +1164,9 @@ class nsZenWorkspaces {
const item = document.createXULElement("menuitem");
item.className = "zen-workspace-context-menu-item";
item.setAttribute("zen-workspace-id", workspace.uuid);
if (AppConstants.platform === "linux") {
disableCurrent = true;
}
if (!disableCurrent) {
item.setAttribute("type", "radio");
}
@@ -1864,11 +1870,6 @@ class nsZenWorkspaces {
}
const newTransform = diff * 100;
element.style.transform = `translateX(${newTransform + offsetPixels / 2}%)`;
// A special case for two spaces
if (spaceLen === 2 && diff !== 0) {
const side = offsetPixels > 0 ? -100 : 100;
element.style.transform = `translateX(${side + offsetPixels / 2}%)`;
}
}
// Hide other essentials with different containerTabId
for (const container of otherContainersEssentials) {
@@ -2099,12 +2100,6 @@ class nsZenWorkspaces {
offset += spaceLen;
}
offset = offset * 100;
// A special case for two spaces
if (spaceLen === 2 && offset !== 0) {
const currentTransform =
parseFloat(element.style.transform.split("(")[1]) || 0;
offset = currentTransform >= 0 ? 100 : -100;
}
const newTransform = `translateX(${offset}%)`;
// Only animate the workspace that is coming in, to avoid having multiple workspaces
// animating off-screen at the same time which can cause performance issues. With an off
@@ -2181,17 +2176,6 @@ class nsZenWorkspaces {
existingOffset = currentTransform || (isGoingLeft ? -100 : 100);
newOffset = 0;
}
if (spaceLen === 2) {
if (containsPrev && !containsNew) {
existingOffset = currentTransform;
newOffset = currentTransform >= 0 ? 100 : -100;
} else {
existingOffset = currentTransform >= 0 ? 100 : -100;
newOffset = 0;
}
}
const newTransform = `translateX(${newOffset}%)`;
let existingTransform = `translateX(${existingOffset}%)`;
if (shouldAnimate) {

View File

@@ -33,10 +33,10 @@ const RECORD_TYPE_BY_PREFIX = Object.freeze({
* Workspaces engine collection.
*/
export class ZenWorkspacesRecord extends CryptoWrapper {
_logName = "Sync.Record.ZenWorkspaces";
_logName = "Sync.Record.ZenSpaces";
}
ZenWorkspacesRecord.prototype.type = "workspaces";
ZenWorkspacesRecord.prototype.type = "spaces";
function parseRecordId(id) {
const sep = id.indexOf("~");
@@ -51,7 +51,7 @@ function parseRecordId(id) {
function createRecordId(type, id) {
const prefix = RECORD_ID_PREFIX_BY_TYPE[type];
if (!prefix) {
throw new Error(`Unknown Workspaces Sync record type: ${type}`);
throw new Error(`Unknown Spaces Sync record type: ${type}`);
}
return `${prefix}~${id}`;
}
@@ -371,11 +371,11 @@ class ZenWorkspacesTracker extends Tracker {
*/
export class ZenWorkspacesEngine extends SyncEngine {
static get name() {
return "Workspaces";
return "Spaces";
}
constructor(service) {
super("Workspaces", service);
super("Spaces", service);
}
get _storeObj() {