Files
desktop/src/zen/common/zen-sets.js
mr. m d93c46fe20 feat: Full cross-window workspace syncing, p=#10034
* feat: Full cross-window workspace syncing, b=no-bug, c=workspaces

* feat: Also change icons and labels if the tab is pending, b=no-bug, c=tabs, workspaces

* feat: Dont session duplicate the tabs, b=no-bug, c=workspaces

* feat: Properly handle tab moves, b=no-bug, c=workspaces

* feat: Start on new session restore, b=no-bug, c=no-component

* Discard changes to prefs/browser.yaml

* feat: Start doing out own session restore, b=no-bug, c=folders, tabs

* feat: Stop using pinned manager and use zen session sidebar, b=no-bug, c=common, folders, tabs, workspaces

* feat: Dont restore windows that are already initialized, b=no-bug, c=no-component

* chore: Update patches to ff 145, b=no-bug, c=no-component

* Discard changes to src/browser/components/sessionstore/SessionStore-sys-mjs.patch

* Discard changes to src/browser/components/tabbrowser/content/tab-js.patch

* Discard changes to src/browser/components/tabbrowser/content/tabbrowser-js.patch

* Discard changes to src/zen/tabs/ZenPinnedTabsStorage.mjs

* feat: Run session saver before opening a new winodw, b=no-bug, c=tabs

* feat: Clone the previous state, b=no-bug, c=no-component

* feat: Move window sync to its own JS module, b=no-bug, c=workspaces

* feat: Run session saver before opening a new window, b=no-bug, c=no-component

* feat: Full cross-window workspace syncing, b=no-bug, c=workspaces

* feat: Also change icons and labels if the tab is pending, b=no-bug, c=tabs, workspaces

* feat: Dont session duplicate the tabs, b=no-bug, c=workspaces

* feat: Start on new session restore, b=no-bug, c=no-component

* feat: Properly handle tab moves, b=no-bug, c=workspaces

* Discard changes to prefs/browser.yaml

* feat: Start doing out own session restore, b=no-bug, c=folders, tabs

* feat: Stop using pinned manager and use zen session sidebar, b=no-bug, c=common, folders, tabs, workspaces

* feat: Dont restore windows that are already initialized, b=no-bug, c=no-component

* chore: Update patches to ff 145, b=no-bug, c=no-component

* Discard changes to src/browser/components/sessionstore/SessionStore-sys-mjs.patch

* Discard changes to src/browser/components/tabbrowser/content/tab-js.patch

* Discard changes to src/browser/components/tabbrowser/content/tabbrowser-js.patch

* Discard changes to src/zen/tabs/ZenPinnedTabsStorage.mjs

* feat: Run session saver before opening a new winodw, b=no-bug, c=tabs

* feat: Clone the previous state, b=no-bug, c=no-component

* feat: Move window sync to its own JS module, b=no-bug, c=workspaces

* feat: Run session saver before opening a new window, b=no-bug, c=no-component

* feat: Start making use of IDs instead of sync identifiers, b=no-bug, c=folders

* feat: Listen to new tab opens for new sync system, b=no-bug, c=common, folders, tabs

* feat: Listen for more tab events and properly sync them, b=no-bug, c=common, folders, tabs

* feat: Start moving browser views to the selected windows, b=no-bug, c=no-component

* chore: Remove extra patch, b=no-bug, c=no-component

* feat: Leave a screenshot of the page behind when switching windows or tabs, b=no-bug, c=common

* feat: Run session saves right before writing and quiting, b=no-bug, c=common

* fix: Fixed going back to a different window not allowing to type on inputs, b=no-bug, c=no-component

* feat: Start syncing folders as well, b=no-bug, c=folders

* Discard changes to src/browser/components/tabbrowser/content/tab-js.patch

* chore: Update patches to ff 146, b=no-bug, c=no-component

* feat: Early support for unsynced windoiws, b=no-bug, c=workspaces

* fix: Move back active views when closing a window, b=no-bug, c=no-component

* feat: Stop rendering sub-layers when swaping browsers, b=no-bug, c=common

* feat: Improved support for unsynced windows support, b=no-bug, c=workspaces, folders

* feat: Implemented 'Move To...' Button for unsynced windows, b=no-bug, c=workspaces, common

* feat: Make sure to properly flush all windows when making a new one and fix removing progress listeners, b=no-bug, c=workspaces

* feat: Make sure to not lose any tabs when opening from a private window, b=no-bug, c=workspaces

* feat: Allow unload to run instantly and fix closing windows on mac, b=no-bug, c=no-component

* feat: Make sure to always initialize an empty state with the sidebar object, b=no-bug, c=workspaces

* chore: Small fixes and QA checks, b=no-bug, c=tabs, workspaces

* fix: Fixed tab labels not changing on unfocused windows, b=no-bug, c=no-component

* feat: Fixed closing windows on macos not returning to the original views, b=no-bug, c=no-component

* chore: Turn off debug flags by default, b=no-bug, c=no-component

* feat: Start implementing old pinned tab behaviour we used to have, b=no-bug, c=common, tabs

* feat: Unsynced windows should always be allowed to change labels, b=no-bug, c=welcome

* feat: Make sure we wait long enough before we initialize workspaces, b=no-bug, c=workspaces

* feat: Dont mix remoteness when changing browser views and restore window spaces, b=no-bug, c=common, folders, workspaces

* test: Fixed tests for the pinned tabs manager, b=no-bug, c=tabs, folders, tests, welcome

* feat: Added partial support for split views, b=no-bug, c=split-view

* chore: Finished basic support for split views, b=no-bug, c=folders, split-view

* feat: Always make sure to save the last closed window to the sidebar object, b=no-bug, c=no-component

* feat: Implement workspace sync store into the session file, b=closes #10857, c=common, tabs, tests, workspaces

* feat: Add a default value for the workspace cache, b=no-bug, c=workspaces

* fix: Default assign an array instead of an object to the workspaces cache, b=no-bug, c=workspaces

* feat: Take into consideration win data may not have allocated spaces, b=no-bug, c=workspaces

* feat: Always make sure we are assigning the correct space ID, b=no-bug, c=workspaces

* feat: Make sure to initialize windows even if there are no tabs, b=no-bug, c=no-component

---------

Signed-off-by: mr. m <91018726+mr-cheffy@users.noreply.github.com>
2025-12-22 11:12:52 +01:00

141 lines
5.0 KiB
JavaScript

// This Source Code Form is subject to the terms of the Mozilla Public
// 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/.
document.addEventListener(
'MozBeforeInitialXULLayout',
() => {
// <commandset id="mainCommandSet"> defined in browser-sets.inc
document.getElementById('zenCommandSet').addEventListener('command', (event) => {
switch (event.target.id) {
case 'cmd_zenCompactModeToggle':
gZenCompactModeManager.toggle();
break;
case 'cmd_zenCompactModeShowSidebar':
gZenCompactModeManager.toggleSidebar();
break;
case 'cmd_toggleCompactModeIgnoreHover':
gZenCompactModeManager.toggle(true);
break;
case 'cmd_zenWorkspaceForward':
gZenWorkspaces.changeWorkspaceShortcut();
break;
case 'cmd_zenWorkspaceBackward':
gZenWorkspaces.changeWorkspaceShortcut(-1);
break;
case 'cmd_zenSplitViewGrid':
gZenViewSplitter.toggleShortcut('grid');
break;
case 'cmd_zenSplitViewVertical':
gZenViewSplitter.toggleShortcut('vsep');
break;
case 'cmd_zenSplitViewHorizontal':
gZenViewSplitter.toggleShortcut('hsep');
break;
case 'cmd_zenSplitViewUnsplit':
gZenViewSplitter.toggleShortcut('unsplit');
break;
case 'cmd_zenSplitViewContextMenu':
gZenViewSplitter.contextSplitTabs();
break;
case 'cmd_zenCopyCurrentURLMarkdown':
gZenCommonActions.copyCurrentURLAsMarkdownToClipboard();
break;
case 'cmd_zenCopyCurrentURL':
gZenCommonActions.copyCurrentURLToClipboard();
break;
case 'cmd_zenPinnedTabReset':
gZenPinnedTabManager.resetPinnedTab(gBrowser.selectedTab);
break;
case 'cmd_zenPinnedTabResetNoTab':
gZenPinnedTabManager.resetPinnedTab();
break;
case 'cmd_zenToggleSidebar':
gZenVerticalTabsManager.toggleExpand();
break;
case 'cmd_zenOpenZenThemePicker':
gZenThemePicker.openThemePicker(event);
break;
case 'cmd_zenChangeWorkspaceTab':
gZenWorkspaces.changeTabWorkspace(
event.sourceEvent.target.getAttribute('zen-workspace-id')
);
break;
case 'cmd_zenToggleTabsOnRight':
gZenVerticalTabsManager.toggleTabsOnRight();
break;
case 'cmd_zenSplitViewLinkInNewTab':
gZenViewSplitter.splitLinkInNewTab();
break;
case 'cmd_zenNewEmptySplit':
setTimeout(() => {
gZenViewSplitter.createEmptySplit();
}, 0);
break;
case 'cmd_zenReplacePinnedUrlWithCurrent':
gZenPinnedTabManager.replacePinnedUrlWithCurrent();
break;
case 'cmd_contextZenAddToEssentials':
gZenPinnedTabManager.addToEssentials();
break;
case 'cmd_contextZenRemoveFromEssentials':
gZenPinnedTabManager.removeEssentials();
break;
case 'cmd_zenCtxDeleteWorkspace':
gZenWorkspaces.contextDeleteWorkspace(event);
break;
case 'cmd_zenChangeWorkspaceName':
gZenVerticalTabsManager.renameTabStart({
target: gZenWorkspaces.activeWorkspaceIndicator.querySelector(
'.zen-current-workspace-indicator-name'
),
});
break;
case 'cmd_zenChangeWorkspaceIcon':
gZenWorkspaces.changeWorkspaceIcon();
break;
case 'cmd_zenReorderWorkspaces':
gZenUIManager.showToast('zen-workspaces-how-to-reorder-title', {
timeout: 9000,
descriptionId: 'zen-workspaces-how-to-reorder-desc',
});
break;
case 'cmd_zenOpenWorkspaceCreation':
gZenWorkspaces.openWorkspaceCreation(event);
break;
case 'cmd_zenOpenFolderCreation':
gZenFolders.createFolder([], {
renameFolder: true,
});
break;
case 'cmd_zenTogglePinTab': {
const currentTab = gBrowser.selectedTab;
if (currentTab && !currentTab.hasAttribute('zen-empty-tab')) {
if (currentTab.pinned) {
gBrowser.unpinTab(currentTab);
} else {
gBrowser.pinTab(currentTab);
}
}
break;
}
case 'cmd_zenCloseUnpinnedTabs':
gZenWorkspaces.closeAllUnpinnedTabs();
break;
case 'cmd_zenUnloadWorkspace': {
gZenWorkspaces.unloadWorkspace();
break;
}
default:
gZenGlanceManager.handleMainCommandSet(event);
if (event.target.id.startsWith('cmd_zenWorkspaceSwitch')) {
const index = parseInt(event.target.id.replace('cmd_zenWorkspaceSwitch', ''), 10) - 1;
gZenWorkspaces.shortcutSwitchTo(index);
}
break;
}
});
},
{ once: true }
);