This commit is contained in:
mr. m
2025-05-09 18:32:12 +02:00
4 changed files with 38 additions and 7 deletions

View File

@@ -126,6 +126,12 @@ pref('zen.workspaces.scroll-modifier-key','ctrl'); // can be ctrl, alt, shift, o
pref('services.sync.engine.workspaces', false);
pref('zen.workspaces.container-specific-essentials-enabled', false);
#ifdef MOZILLA_OFFICIAL
pref('zen.workspaces.debug', false);
#else
pref('zen.workspaces.debug', true);
#endif
// Zen Split View
pref('zen.splitView.enable-tab-drop', true);
pref('zen.splitView.min-resize-width', 7);

View File

@@ -547,6 +547,7 @@ button.popup-notification-dropmarker {
margin-right: 28px !important;
position: relative;
scale: 0.93;
transform-origin: right;
&::after {
content: '';

View File

@@ -3,11 +3,26 @@
'use strict';
add_setup(async function () {
await ZenWorkspaces.createAndSaveWorkspace('Test Workspace 2');
});
add_setup(async function () {});
add_task(async function test_Check_Creation() {
const currentWorkspaceUUID = ZenWorkspaces.activeWorkspace;
await ZenWorkspaces.createAndSaveWorkspace('Test Workspace 2');
const workspaces = await ZenWorkspaces._workspaces();
ok(workspaces.workspaces.length, 2);
ok(workspaces.workspaces.length === 2, 'Two workspaces should exist.');
ok(currentWorkspaceUUID !== workspaces.workspaces[1].uuid, 'The new workspace should be different from the current one.');
let newTab = BrowserTestUtils.addTab(gBrowser, 'about:blank', {
skipAnimation: true,
});
ok(newTab, 'New tab should be opened.');
ok(gBrowser.tabs.length === 2, 'There should be two tabs.');
BrowserTestUtils.removeTab(newTab);
await ZenWorkspaces.removeWorkspace(ZenWorkspaces.activeWorkspace);
const workspacesAfterRemove = await ZenWorkspaces._workspaces();
ok(workspacesAfterRemove.workspaces.length, 1);
ok(workspacesAfterRemove.workspaces[0].uuid === currentWorkspaceUUID, 'The workspace should be the one we started with.');
ok(gBrowser.tabs.length, 1);
});

View File

@@ -10,6 +10,8 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
_inChangingWorkspace = false;
draggedElement = null;
#canDebug = Services.prefs.getBoolPref('zen.workspaces.debug', false);
_swipeState = {
isGestureActive: true,
lastDelta: 0,
@@ -94,13 +96,19 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
this.addPopupListeners();
}
log(...args) {
if (this.#canDebug) {
console.debug(`ZenWorkspaces:`, ...args);
}
}
async afterLoadInit() {
await SessionStore.promiseInitialized;
if (!this._hasInitializedTabsStrip) {
await this.delayedStartup();
}
await this.promiseSectionsInitialized;
console.info('ZenWorkspaces: ZenWorkspaces initialized');
this.log('ZenWorkspaces: ZenWorkspaces initialized');
await this.initializeWorkspaces();
if (Services.prefs.getBoolPref('zen.workspaces.swipe-actions', false) && this.workspaceEnabled) {
@@ -818,6 +826,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
if (typeof this._tabToSelect === 'number' && this._tabToSelect >= 0) {
setTimeout(() => {
const tabs = gBrowser.tabs.filter((tab) => !tab.collapsed && !tab.hasAttribute('zen-empty-tab'));
this.log(`Found tab to select: ${this._tabToSelect}, ${tabs.length}`);
gBrowser.selectedTab = tabs[this._tabToSelect];
this._removedByStartupPage = true;
gBrowser.removeTab(this._tabToRemoveForEmpty, {
@@ -1145,7 +1154,6 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
async removeWorkspace(windowID) {
let workspacesData = await this._workspaces();
console.info('ZenWorkspaces: Removing workspace', windowID);
await this.changeWorkspace(workspacesData.workspaces.find((workspace) => workspace.uuid !== windowID));
this._deleteAllTabsInWorkspace(windowID);
delete this._lastSelectedWorkspaceTabs[windowID];
@@ -1817,6 +1825,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
}
this._inChangingWorkspace = true;
try {
this.log('Changing workspace to', window?.uuid);
await this._performWorkspaceChange(window, ...args);
} catch (e) {
console.error('ZenWorkspaces: Error changing workspace', e);
@@ -2244,7 +2253,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
_shouldShowTab(tab, workspaceUuid, containerId, workspaces) {
const isEssential = tab.getAttribute('zen-essential') === 'true';
const tabWorkspaceId = tab.getAttribute('zen-workspace-id');
const tabContextId = tab.getAttribute('usercontextid');
const tabContextId = tab.getAttribute('usercontextid') ?? '0';
if (tab.hasAttribute('zen-glance-tab')) {
return true; // Always show glance tabs