diff --git a/configs/windows/mozconfig b/configs/windows/mozconfig index 3cbb0e45..8d404395 100644 --- a/configs/windows/mozconfig +++ b/configs/windows/mozconfig @@ -37,7 +37,7 @@ if test "$SURFER_COMPAT" = "x86_64"; then export RUSTFLAGS="-Clink-args=--icf=safe" elif test "$SURFER_COMPAT" = "aarch64"; then ac_add_options --target=aarch64-pc-windows-msvc - ac_add_options --enable-eme=widevine,wmfcdm + ac_add_options --enable-eme=widevine ac_add_options --enable-optimize="-O2 -mtune=cortex-a55 -march=armv8.2-a+simd" diff --git a/src/browser/base/content/zen-popupset.inc.xhtml b/src/browser/base/content/zen-popupset.inc.xhtml index b63212a9..ef03daec 100644 --- a/src/browser/base/content/zen-popupset.inc.xhtml +++ b/src/browser/base/content/zen-popupset.inc.xhtml @@ -1,5 +1,5 @@ - + @@ -34,7 +34,7 @@ - + @@ -45,7 +45,7 @@ - + @@ -57,16 +57,16 @@ - +

- + - +
@@ -78,14 +78,14 @@

- - + +
- -
@@ -93,43 +93,39 @@

- - + +
- - - +
- - + + - - + - + - + diff --git a/src/browser/base/content/zen-sidebar-icons.inc.xhtml b/src/browser/base/content/zen-sidebar-icons.inc.xhtml index 00401169..604f38c8 100644 --- a/src/browser/base/content/zen-sidebar-icons.inc.xhtml +++ b/src/browser/base/content/zen-sidebar-icons.inc.xhtml @@ -8,6 +8,6 @@ skipintoolbarset="true" context="toolbar-context-menu" mode="icons"> - + diff --git a/src/browser/themes/shared/zen-icons/icons.css b/src/browser/themes/shared/zen-icons/icons.css index b671195c..6b2f74dc 100644 --- a/src/browser/themes/shared/zen-icons/icons.css +++ b/src/browser/themes/shared/zen-icons/icons.css @@ -168,10 +168,6 @@ --menu-image: url('open.svg') !important; } -#context_zenSetAsDefaultWorkspace { - --menu-image: url('bookmark-hollow.svg') !important; -} - #context_zenEditWorkspace, #zenToolbarThemePicker { --menu-image: url('edit-theme.svg') !important; diff --git a/src/zen/common/zen-sets.js b/src/zen/common/zen-sets.js index 6e6e0ab5..f5534d18 100644 --- a/src/zen/common/zen-sets.js +++ b/src/zen/common/zen-sets.js @@ -17,6 +17,15 @@ document.addEventListener( case 'cmd_zenCompactModeShowSidebar': gZenCompactModeManager.toggleSidebar(); break; + case 'cmd_zenCompactModeHideSidebar': + gZenCompactModeManager.hideSidebar(); + break; + case 'cmd_zenCompactModeHideToolbar': + gZenCompactModeManager.hideToolbar(); + break; + case 'cmd_zenCompactModeHideBoth': + gZenCompactModeManager.hideBoth(); + break; case 'cmd_zenCompactModeShowToolbar': gZenCompactModeManager.toggleToolbar(); break; @@ -38,6 +47,9 @@ document.addEventListener( case 'cmd_zenSplitViewUnsplit': gZenViewSplitter.toggleShortcut('unsplit'); break; + case 'cmd_zenSplitViewContextMenu': + gZenViewSplitter.contextSplitTabs(); + break; case 'cmd_zenCopyCurrentURLMarkdown': gZenCommonActions.copyCurrentURLAsMarkdownToClipboard(); break; diff --git a/src/zen/compact-mode/ZenCompactMode.mjs b/src/zen/compact-mode/ZenCompactMode.mjs index f0aed832..efb7ccdd 100644 --- a/src/zen/compact-mode/ZenCompactMode.mjs +++ b/src/zen/compact-mode/ZenCompactMode.mjs @@ -106,11 +106,11 @@ var gZenCompactModeManager = { const fragment = window.MozXULElement.parseXULToFragment(` - + - - - + + + `); diff --git a/src/zen/split-view/ZenViewSplitter.mjs b/src/zen/split-view/ZenViewSplitter.mjs index 25c2e332..f2c010be 100644 --- a/src/zen/split-view/ZenViewSplitter.mjs +++ b/src/zen/split-view/ZenViewSplitter.mjs @@ -839,7 +839,7 @@ class ZenViewSplitter extends ZenDOMOperatedFeature { + command="cmd_zenSplitViewContextMenu"/> `); document.getElementById('context_closeDuplicateTabs').after(element); diff --git a/src/zen/tabs/zen-tabs/vertical-tabs.css b/src/zen/tabs/zen-tabs/vertical-tabs.css index 74a0fc9d..d7eabe5e 100644 --- a/src/zen/tabs/zen-tabs/vertical-tabs.css +++ b/src/zen/tabs/zen-tabs/vertical-tabs.css @@ -1267,10 +1267,16 @@ transform: translateX(-100%); &:not(.zen-essentials-container) { + display: flex; min-width: calc(100% - var(--zen-toolbox-padding) * 2); } &:not(.zen-current-workspace-indicator):not(.zen-essentials-container) { margin: 0 var(--zen-toolbox-padding); } + + &[hidden='true'] { + opacity: 0; + pointer-events: none; + } } diff --git a/src/zen/workspaces/ZenGradientGenerator.mjs b/src/zen/workspaces/ZenGradientGenerator.mjs index 920f8ab2..06d31b57 100644 --- a/src/zen/workspaces/ZenGradientGenerator.mjs +++ b/src/zen/workspaces/ZenGradientGenerator.mjs @@ -35,6 +35,14 @@ this.onDarkModeChange.bind(this) ); + this.panel.addEventListener('popupshowing', this.handlePanelOpen.bind(this)); + this.panel.addEventListener('popuphidden', this.handlePanelClose.bind(this)); + this.panel.addEventListener('command', this.handlePanelCommand.bind(this)); + + document + .getElementById('PanelUI-zen-gradient-generator-opacity') + .addEventListener('input', this.onOpacityChange.bind(this)); + this.initCanvas(); this.initCustomColorInput(); this.initTextureInput(); @@ -404,6 +412,18 @@ await this.updateCurrentWorkspace(); } + handlePanelCommand(event) { + const target = event.target.closest('toolbarbutton'); + if (!target) { + return; + } + switch (target.id) { + case 'PanelUI-zen-gradient-generator-color-custom-add': + this.addCustomColor(); + break; + } + } + spawnDot(relativePosition, primary = false) { const dotPad = this.panel.querySelector('.zen-theme-picker-gradient'); diff --git a/src/zen/workspaces/ZenWorkspaces.mjs b/src/zen/workspaces/ZenWorkspaces.mjs index 519abac1..5d62566a 100644 --- a/src/zen/workspaces/ZenWorkspaces.mjs +++ b/src/zen/workspaces/ZenWorkspaces.mjs @@ -91,6 +91,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { this._activeWorkspace = Services.prefs.getStringPref('zen.workspaces.active', ''); window.addEventListener('resize', this.onWindowResize.bind(this)); + this.addPopupListeners(); } async afterLoadInit() { @@ -259,7 +260,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { async _createDefaultWorkspaceIfNeeded() { const workspaces = await this._workspaces(); if (!workspaces.workspaces.length) { - await this.createAndSaveWorkspace('Default', true, null, true); + await this.createAndSaveWorkspace('Space', null, true); this._workspaceCache = null; } } @@ -889,6 +890,87 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { return null; } + addPopupListeners() { + const popup = document.getElementById('PanelUI-zen-workspaces'); + const contextMenu = document.getElementById('zenWorkspaceActionsMenu'); + + popup.addEventListener('popuphidden', this.handlePanelHidden.bind(this)); + popup.addEventListener('command', this.handlePanelCommand.bind(this)); + + contextMenu.addEventListener('popuphidden', (event) => { + if (event.target === contextMenu) { + this.onContextMenuClose(event); + } + }); + contextMenu.addEventListener('onpopupshowing', this.updateContextMenu.bind(this)); + contextMenu.addEventListener('command', this.handleContextMenuCommand.bind(this)); + + const submenu = document.querySelector('#context_zenWorkspacesOpenInContainerTab > menupopup'); + if (submenu) { + submenu.addEventListener('popupshowing', this.createContainerTabMenu.bind(this)); + submenu.addEventListener('command', this.contextChangeContainerTab.bind(this)); + } + + const onWorkspaceIconContainerClick = this.onWorkspaceIconContainerClick.bind(this); + for (const element of document.querySelectorAll('.PanelUI-zen-workspaces-icons-container')) { + element.addEventListener('command', onWorkspaceIconContainerClick); + } + + document + .getElementById('PanelUI-zen-workspaces-create-input') + .addEventListener('input', this.onWorkspaceCreationNameChange.bind(this)); + document + .getElementById('PanelUI-zen-workspaces-edit-input') + .addEventListener('input', this.onWorkspaceEditChange.bind(this)); + document + .getElementById('PanelUI-zen-workspaces-icon-search-input') + .addEventListener('input', this.conductSearch.bind(this)); + } + + handlePanelCommand(event) { + let target = event.target.closest('toolbarbutton'); + target ??= event.target.closest('button'); + if (!target) { + return; + } + switch (target.id) { + case 'PanelUI-zen-workspaces-reorder-mode': + this.toggleReorderMode(); + break; + case 'PanelUI-zen-workspaces-new': + this.openSaveDialog(); + break; + case 'PanelUI-zen-workspaces-create-save': + this.saveWorkspaceFromCreate(); + break; + case 'PanelUI-zen-workspaces-edit-cancel': + case 'PanelUI-zen-workspaces-create-cancel': + this.closeWorkspacesSubView(); + break; + case 'PanelUI-zen-workspaces-edit-save': + this.saveWorkspaceFromEdit(); + break; + } + } + + handleContextMenuCommand(event) { + const target = event.target.closest('toolbarbutton'); + if (!target) { + return; + } + switch (target.id) { + case 'context_zenOpenWorkspace': + this.openWorkspace(); + break; + case 'context_zenEditWorkspace': + this.contextEdit(event); + break; + case 'context_zenDeleteWorkspace': + this.contextDelete(event); + break; + } + } + searchIcons(input, icons) { input = input.toLowerCase(); @@ -1042,11 +1124,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { async getActiveWorkspace() { const workspaces = await this._workspaces(); - return ( - workspaces.workspaces.find((workspace) => workspace.uuid === this.activeWorkspace) ?? - workspaces.workspaces.find((workspace) => workspace.default) ?? - workspaces.workspaces[0] - ); + return workspaces.workspaces.find((workspace) => workspace.uuid === this.activeWorkspace) ?? workspaces.workspaces[0]; } // Workspaces dialog UI management @@ -1157,9 +1235,6 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { if (this.isWorkspaceActive(workspace)) { element.setAttribute('active', 'true'); } - if (workspace.default) { - element.setAttribute('default', 'true'); - } let containerGroup = undefined; try { containerGroup = browser.ContextualIdentityService.getPublicIdentities().find( @@ -1519,11 +1594,6 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { } else { workspaceButton.removeAttribute('active'); } - if (workspace.default) { - workspaceButton.setAttribute('default', 'true'); - } else { - workspaceButton.removeAttribute('default'); - } workspaceButton.addEventListener('click', async (event) => { if (event.button !== 0) { @@ -1641,7 +1711,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { this._workspaceCreateInput.value = ''; let icon = document.querySelector('#PanelUI-zen-workspaces-icon-picker-wrapper [selected]'); icon?.removeAttribute('selected'); - await this.createAndSaveWorkspace(workspaceName, false, icon?.label); + await this.createAndSaveWorkspace(workspaceName, icon?.label); this.goToPreviousSubView(); } @@ -1662,7 +1732,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { this.goToPreviousSubView(); } - onWorkspaceCreationNameChange(event) { + onWorkspaceCreationNameChange() { let button = document.getElementById('PanelUI-zen-workspaces-create-save'); if (this._workspaceCreateInput.value === '') { button.setAttribute('disabled', 'true'); @@ -1767,17 +1837,24 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { } _updateMarginTopPinnedTabs(arrowscrollbox, pinnedContainer, essentialContainer, workspaceIndicator) { - if (arrowscrollbox && !pinnedContainer.hasAttribute('hidden')) { + if (arrowscrollbox) { const essentialsHeight = essentialContainer.getBoundingClientRect().height; pinnedContainer.style.marginTop = essentialsHeight + 'px'; workspaceIndicator.style.marginTop = essentialsHeight + 'px'; - const arrowMarginTop = pinnedContainer.getBoundingClientRect().height + essentialsHeight + 'px'; + let arrowMarginTop = pinnedContainer.getBoundingClientRect().height; + const isActive = arrowscrollbox.getAttribute('active') === 'true'; + if (isActive || !this.containerSpecificEssentials) { + document.getElementById('zen-tabs-wrapper').style.marginTop = essentialsHeight + 'px'; + pinnedContainer.style.marginTop = ''; + } else { + arrowMarginTop += essentialsHeight; + } if (!true) { // TODO: gZenUIManager.motion.animate( arrowscrollbox, { - marginTop: [arrowscrollbox.style.marginTop, arrowMarginTop], + marginTop: [arrowscrollbox.style.marginTop, arrowMarginTop + 'px'], }, { type: 'spring', @@ -1786,7 +1863,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { } ); } else { - arrowscrollbox.style.marginTop = arrowMarginTop; + arrowscrollbox.style.marginTop = arrowMarginTop + 'px'; } } } @@ -2166,10 +2243,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { } } - _createWorkspaceData(name, isDefault, icon, tabs, moveTabs = true) { + _createWorkspaceData(name, icon, tabs, moveTabs = true) { let window = { uuid: gZenUIManager.generateUuidv4(), - default: isDefault, icon: icon, name: name, theme: ZenThemePicker.getTheme([]), @@ -2184,7 +2260,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { return window; } - async createAndSaveWorkspace(name = 'New Workspace', isDefault = false, icon = undefined, dontChange = false) { + async createAndSaveWorkspace(name = 'Space', icon = undefined, dontChange = false) { if (!this.workspaceEnabled) { return; } @@ -2192,7 +2268,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { const extraTabs = Array.from(gBrowser.tabContainer.arrowScrollbox.children).filter( (child) => child.tagName === 'tab' && !child.hasAttribute('zen-workspace-id') ); - let workspaceData = this._createWorkspaceData(name, isDefault, icon, extraTabs, !dontChange); + let workspaceData = this._createWorkspaceData(name, icon, extraTabs, !dontChange); await this.saveWorkspace(workspaceData, dontChange); if (!dontChange) { this.registerPinnedResizeObserver(); @@ -2369,20 +2445,11 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { .setAttribute('active', 'true'); const workspaces = await this._workspaces(); let deleteMenuItem = document.getElementById('context_zenDeleteWorkspace'); - if ( - workspaces.workspaces.length <= 1 || - workspaces.workspaces.find((workspace) => workspace.uuid === this._contextMenuId).default - ) { + if (workspaces.workspaces.length <= 1) { deleteMenuItem.setAttribute('disabled', 'true'); } else { deleteMenuItem.removeAttribute('disabled'); } - let defaultMenuItem = document.getElementById('context_zenSetAsDefaultWorkspace'); - if (workspaces.workspaces.find((workspace) => workspace.uuid === this._contextMenuId).default) { - defaultMenuItem.setAttribute('disabled', 'true'); - } else { - defaultMenuItem.removeAttribute('disabled'); - } let openMenuItem = document.getElementById('context_zenOpenWorkspace'); if ( workspaces.workspaces.find((workspace) => workspace.uuid === this._contextMenuId && this.isWorkspaceActive(workspace)) @@ -2424,11 +2491,6 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { return tab; } - async setDefaultWorkspace() { - await ZenWorkspacesStorage.setDefaultWorkspace(this._contextMenuId); - await this._propagateWorkspaceData(); - } - async openWorkspace() { let workspaces = await this._workspaces(); let workspace = workspaces.workspaces.find((workspace) => workspace.uuid === this._contextMenuId); diff --git a/src/zen/workspaces/ZenWorkspacesStorage.mjs b/src/zen/workspaces/ZenWorkspacesStorage.mjs index c9257719..b157dc86 100644 --- a/src/zen/workspaces/ZenWorkspacesStorage.mjs +++ b/src/zen/workspaces/ZenWorkspacesStorage.mjs @@ -21,7 +21,6 @@ var ZenWorkspacesStorage = { uuid TEXT UNIQUE NOT NULL, name TEXT NOT NULL, icon TEXT, - is_default INTEGER NOT NULL DEFAULT 0, container_id INTEGER, position INTEGER NOT NULL DEFAULT 0, created_at INTEGER NOT NULL, @@ -111,17 +110,6 @@ var ZenWorkspacesStorage = { await db.executeTransaction(async () => { const now = Date.now(); - // Handle default workspace - if (workspace.default) { - await db.execute(`UPDATE zen_workspaces SET is_default = 0 WHERE uuid != :uuid`, { uuid: workspace.uuid }); - const unsetDefaultRows = await db.execute(`SELECT uuid FROM zen_workspaces WHERE is_default = 0 AND uuid != :uuid`, { - uuid: workspace.uuid, - }); - for (const row of unsetDefaultRows) { - changedUUIDs.add(row.getResultByName('uuid')); - } - } - let newPosition; if ('position' in workspace && Number.isFinite(workspace.position)) { newPosition = workspace.position; @@ -136,10 +124,10 @@ var ZenWorkspacesStorage = { await db.executeCached( ` INSERT OR REPLACE INTO zen_workspaces ( - uuid, name, icon, is_default, container_id, created_at, updated_at, "position", + uuid, name, icon, container_id, created_at, updated_at, "position", theme_type, theme_colors, theme_opacity, theme_rotation, theme_texture ) VALUES ( - :uuid, :name, :icon, :is_default, :container_id, + :uuid, :name, :icon, :container_id, COALESCE((SELECT created_at FROM zen_workspaces WHERE uuid = :uuid), :now), :now, :position, @@ -150,7 +138,6 @@ var ZenWorkspacesStorage = { uuid: workspace.uuid, name: workspace.name, icon: workspace.icon || null, - is_default: workspace.default ? 1 : 0, container_id: workspace.containerTabId || null, now, position: newPosition, @@ -194,7 +181,6 @@ var ZenWorkspacesStorage = { uuid: row.getResultByName('uuid'), name: row.getResultByName('name'), icon: row.getResultByName('icon'), - default: !!row.getResultByName('is_default'), containerTabId: row.getResultByName('container_id') ?? 0, position: row.getResultByName('position'), theme: row.getResultByName('theme_type') @@ -249,50 +235,6 @@ var ZenWorkspacesStorage = { }); }, - async setDefaultWorkspace(uuid, notifyObservers = true) { - const changedUUIDs = []; - - await this.lazy.PlacesUtils.withConnectionWrapper('ZenWorkspacesStorage.setDefaultWorkspace', async (db) => { - await db.executeTransaction(async () => { - const now = Date.now(); - // Unset the default flag for all other workspaces - await db.execute(`UPDATE zen_workspaces SET is_default = 0 WHERE uuid != :uuid`, { uuid }); - - // Collect UUIDs of workspaces that were unset as default - const unsetDefaultRows = await db.execute(`SELECT uuid FROM zen_workspaces WHERE is_default = 0 AND uuid != :uuid`, { - uuid, - }); - for (const row of unsetDefaultRows) { - changedUUIDs.push(row.getResultByName('uuid')); - } - - // Set the default flag for the specified workspace - await db.execute(`UPDATE zen_workspaces SET is_default = 1 WHERE uuid = :uuid`, { uuid }); - - // Record the change for the specified workspace - await db.execute( - ` - INSERT OR REPLACE INTO zen_workspaces_changes (uuid, timestamp) - VALUES (:uuid, :timestamp) - `, - { - uuid, - timestamp: Math.floor(now / 1000), - } - ); - - // Add the main workspace UUID to the changed set - changedUUIDs.push(uuid); - - await this.updateLastChangeTimestamp(db); - }); - }); - - if (notifyObservers) { - this._notifyWorkspacesChanged('zen-workspace-updated', changedUUIDs); - } - }, - async markChanged(uuid) { await this.lazy.PlacesUtils.withConnectionWrapper('ZenWorkspacesStorage.markChanged', async (db) => { const now = Date.now();