Compare commits

...

10 Commits

15 changed files with 86 additions and 19 deletions

View File

@@ -23,6 +23,9 @@ zen-workspaces-panel-change-icon =
zen-workspaces-panel-context-default-profile = zen-workspaces-panel-context-default-profile =
.label = Set Profile .label = Set Profile
zen-workspaces-panel-unload =
.label = Unload Space
zen-workspaces-how-to-reorder-title = How to reorder spaces zen-workspaces-how-to-reorder-title = How to reorder spaces
zen-workspaces-how-to-reorder-desc = Drag the space icons at the bottom of the sidebar to reorder them zen-workspaces-how-to-reorder-desc = Drag the space icons at the bottom of the sidebar to reorder them

View File

@@ -51,3 +51,6 @@
- name: zen.view.context-menu.refresh - name: zen.view.context-menu.refresh
value: false value: false
- name: zen.view.borderless-fullscreen
value: true

View File

@@ -11,6 +11,9 @@
- name: zen.tabs.rename-tabs - name: zen.tabs.rename-tabs
value: true value: true
- name: zen.tabs.essentials.max
value: 12
- name: zen.tabs.show-newtab-vertical - name: zen.tabs.show-newtab-vertical
value: true value: true

View File

@@ -42,6 +42,7 @@
<command id="cmd_contextZenRemoveFromEssentials" /> <command id="cmd_contextZenRemoveFromEssentials" />
<command id="cmd_zenCtxDeleteWorkspace" /> <command id="cmd_zenCtxDeleteWorkspace" />
<command id="cmd_zenUnloadWorkspace" />
<command id="cmd_zenChangeWorkspaceName" /> <command id="cmd_zenChangeWorkspaceName" />
<command id="cmd_zenChangeWorkspaceIcon" /> <command id="cmd_zenChangeWorkspaceIcon" />
<command id="cmd_zenReorderWorkspaces" /> <command id="cmd_zenReorderWorkspaces" />

View File

@@ -25,6 +25,7 @@
hide-if-usercontext-disabled="true"> hide-if-usercontext-disabled="true">
<menupopup /> <menupopup />
</menu> </menu>
<menuitem id="context_zenUnloadWorkspace" data-l10n-id="zen-workspaces-panel-unload" command="cmd_zenUnloadWorkspace"/>
<menuseparator id="context_zenWorkspacesSeparator"/> <menuseparator id="context_zenWorkspacesSeparator"/>
<menuseparator/> <menuseparator/>
<menuitem id="context_zenReorderWorkspaces" data-l10n-id="zen-workspaces-panel-context-reorder" command="cmd_zenReorderWorkspaces"/> <menuitem id="context_zenReorderWorkspaces" data-l10n-id="zen-workspaces-panel-context-reorder" command="cmd_zenReorderWorkspaces"/>

View File

@@ -106,12 +106,20 @@ export var ZenCustomizableUI = new (class {
_initCreateNewButton(window) { _initCreateNewButton(window) {
const button = window.document.getElementById('zen-create-new-button'); const button = window.document.getElementById('zen-create-new-button');
button.addEventListener('command', () => { button.addEventListener('command', (event) => {
if (button.hasAttribute('open')) { if (button.hasAttribute('open')) {
return; return;
} }
const popup = window.document.getElementById('zenCreateNewPopup'); const popup = window.document.getElementById('zenCreateNewPopup');
popup.openPopup(button, 'before_start'); popup.openPopup(
button,
'before_start',
0,
0,
true /* isContextMenu */,
false /* attributesOverride */,
event
);
}); });
} }

View File

@@ -109,6 +109,10 @@
border-radius: 0px !important; border-radius: 0px !important;
} }
#urlbar:not([breakout-extend='true']) .urlbar-input-box {
font-weight: 500;
}
:root[zen-single-toolbar='true'] #urlbar:not([breakout-extend='true']) { :root[zen-single-toolbar='true'] #urlbar:not([breakout-extend='true']) {
& #urlbar-input { & #urlbar-input {
cursor: default; cursor: default;

View File

@@ -131,6 +131,10 @@ document.addEventListener(
} }
break; break;
} }
case 'cmd_zenUnloadWorkspace': {
gZenWorkspaces.unloadWorkspace();
break;
}
default: default:
gZenGlanceManager.handleMainCommandSet(event); gZenGlanceManager.handleMainCommandSet(event);
if (event.target.id.startsWith('cmd_zenWorkspaceSwitch')) { if (event.target.id.startsWith('cmd_zenWorkspaceSwitch')) {

View File

@@ -96,7 +96,8 @@ var ZenThemeModifier = {
if ( if (
window.fullScreen && window.fullScreen &&
window.gZenCompactModeManager?.preference && window.gZenCompactModeManager?.preference &&
!document.getElementById('tabbrowser-tabbox')?.hasAttribute('zen-split-view') !document.getElementById('tabbrowser-tabbox')?.hasAttribute('zen-split-view') &&
Services.prefs.getBoolPref('zen.view.borderless-fullscreen', true)
) { ) {
separation = 0; separation = 0;
} }

View File

@@ -418,6 +418,7 @@ var gZenCompactModeManager = {
} else { } else {
this.sidebar.removeAttribute('animate'); // remove the attribute if we are not animating this.sidebar.removeAttribute('animate'); // remove the attribute if we are not animating
document.documentElement.removeAttribute('zen-compact-animating'); document.documentElement.removeAttribute('zen-compact-animating');
resolve();
} }
}); });
}); });
@@ -593,7 +594,7 @@ var gZenCompactModeManager = {
} }
if ( if (
event.explicitOriginalTarget.closest('#urlbar[zen-floating-urlbar]') || event.explicitOriginalTarget?.closest?.('#urlbar[zen-floating-urlbar]') ||
(document.documentElement.getAttribute('supress-primary-adjustment') === 'true' && (document.documentElement.getAttribute('supress-primary-adjustment') === 'true' &&
gZenVerticalTabsManager._hasSetSingleToolbar) || gZenVerticalTabsManager._hasSetSingleToolbar) ||
this._hasHoveredUrlbar this._hasHoveredUrlbar

View File

@@ -1615,11 +1615,6 @@
const parentWorkingData = tabFolderWorkingData.get(stateData.parentId); const parentWorkingData = tabFolderWorkingData.get(stateData.parentId);
if (parentWorkingData && parentWorkingData.node) { if (parentWorkingData && parentWorkingData.node) {
switch (stateData?.prevSiblingInfo?.type) { switch (stateData?.prevSiblingInfo?.type) {
case 'group': {
const folder = document.getElementById(stateData.prevSiblingInfo.id);
folder.after(node);
break;
}
case 'tab': { case 'tab': {
const tab = parentWorkingData.node.querySelector( const tab = parentWorkingData.node.querySelector(
`[zen-pin-id="${stateData.prevSiblingInfo.id}"]` `[zen-pin-id="${stateData.prevSiblingInfo.id}"]`
@@ -1627,6 +1622,18 @@
tab.after(node); tab.after(node);
break; break;
} }
case 'group': {
const folder = document.getElementById(stateData.prevSiblingInfo.id);
if (folder) {
folder.after(node);
break;
}
// If we didn't find the group, we should debug it and continue to default case.
console.warn(
`Zen Folders: Could not find previous sibling group with id ${stateData.prevSiblingInfo.id} while restoring session.`
);
// @eslint-disable-next-line no-fallthrough
}
default: { default: {
// Should insert after zen-empty-tab // Should insert after zen-empty-tab
const start = const start =

View File

@@ -108,6 +108,10 @@
transform: translateY(0) !important; transform: translateY(0) !important;
pointer-events: auto; pointer-events: auto;
} }
& #zen-media-info-vbox label[overflow] {
animation: zen-back-and-forth-text 10s infinite ease-in-out;
}
} }
& #zen-media-focus-button::after { & #zen-media-focus-button::after {
@@ -255,10 +259,6 @@
margin-left: 0; margin-left: 0;
font-weight: 500; font-weight: 500;
position: relative; /* For the animation */ position: relative; /* For the animation */
&[overflow] {
animation: zen-back-and-forth-text 10s infinite ease-in-out;
}
} }
} }

View File

@@ -38,6 +38,12 @@
'zen.pinned-tab-manager.close-shortcut-behavior', 'zen.pinned-tab-manager.close-shortcut-behavior',
'switch' 'switch'
); );
XPCOMUtils.defineLazyPreferenceGetter(
lazy,
'zenTabsEssentialsMax',
'zen.tabs.essentials.max',
12
);
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
E10SUtils: 'resource://gre/modules/E10SUtils.sys.mjs', E10SUtils: 'resource://gre/modules/E10SUtils.sys.mjs',
}); });
@@ -68,8 +74,6 @@
} }
class nsZenPinnedTabManager extends nsZenDOMOperatedFeature { class nsZenPinnedTabManager extends nsZenDOMOperatedFeature {
MAX_ESSENTIALS_TABS = 12;
hasInitializedPins = false; hasInitializedPins = false;
promiseInitializedPinned = new Promise((resolve) => { promiseInitializedPinned = new Promise((resolve) => {
this._resolvePinnedInitializedInternal = resolve; this._resolvePinnedInitializedInternal = resolve;
@@ -140,6 +144,10 @@
return !gZenWorkspaces.privateWindowOrDisabled; return !gZenWorkspaces.privateWindowOrDisabled;
} }
get maxEssentialTabs() {
return lazy.zenTabsEssentialsMax;
}
async refreshPinnedTabs({ init = false } = {}) { async refreshPinnedTabs({ init = false } = {}) {
if (!this.enabled) { if (!this.enabled) {
return; return;
@@ -1055,7 +1063,7 @@
const element = window.MozXULElement.parseXULToFragment(` const element = window.MozXULElement.parseXULToFragment(`
<menuitem id="context_zen-add-essential" <menuitem id="context_zen-add-essential"
data-l10n-id="tab-context-zen-add-essential" data-l10n-id="tab-context-zen-add-essential"
data-l10n-args='{"num": "0"}' data-l10n-args='{"num": "0", "max": "12"}'
hidden="true" hidden="true"
disabled="true" disabled="true"
command="cmd_contextZenAddToEssentials"/> command="cmd_contextZenAddToEssentials"/>
@@ -1081,6 +1089,7 @@
contextTab.getAttribute('zen-essential') || !!contextTab.group; contextTab.getAttribute('zen-essential') || !!contextTab.group;
document.l10n.setArgs(document.getElementById('context_zen-add-essential'), { document.l10n.setArgs(document.getElementById('context_zen-add-essential'), {
num: gBrowser._numZenEssentials, num: gBrowser._numZenEssentials,
max: this.maxEssentialTabs,
}); });
document document
.getElementById('cmd_contextZenAddToEssentials') .getElementById('cmd_contextZenAddToEssentials')
@@ -1404,7 +1413,7 @@
(tab.getAttribute('usercontextid') || 0) != (tab.getAttribute('usercontextid') || 0) !=
gZenWorkspaces.getActiveWorkspaceFromCache().containerTabId && gZenWorkspaces.getActiveWorkspaceFromCache().containerTabId &&
gZenWorkspaces.containerSpecificEssentials gZenWorkspaces.containerSpecificEssentials
) && gBrowser._numZenEssentials < this.MAX_ESSENTIALS_TABS ) && gBrowser._numZenEssentials < this.maxEssentialTabs
); );
} }

View File

@@ -1479,6 +1479,26 @@ var gZenWorkspaces = new (class extends nsZenMultiWindowFeature {
}); });
} }
async unloadWorkspace() {
const workspaceId = this.#contextMenuData?.workspaceId || this.activeWorkspace;
const tabsToUnload = this.allStoredTabs.filter(
(tab) =>
tab.getAttribute('zen-workspace-id') === workspaceId &&
!tab.hasAttribute('zen-empty-tab') &&
!tab.hasAttribute('zen-essential') &&
!tab.hasAttribute('pending')
);
if (tabsToUnload.length === 0) {
return;
}
this.log('Unloading workspace', workspaceId);
await gBrowser.explicitUnloadTabs(tabsToUnload); // TODO: unit test this
}
moveTabToWorkspace(tab, workspaceID) { moveTabToWorkspace(tab, workspaceID) {
return this.moveTabsToWorkspace([tab], workspaceID); return this.moveTabsToWorkspace([tab], workspaceID);
} }
@@ -2541,7 +2561,9 @@ var gZenWorkspaces = new (class extends nsZenMultiWindowFeature {
this._lastSelectedWorkspaceTabs[workspaceID] = gZenGlanceManager.getTabOrGlanceParent(tab); this._lastSelectedWorkspaceTabs[workspaceID] = gZenGlanceManager.getTabOrGlanceParent(tab);
tab.removeAttribute('change-workspace'); tab.removeAttribute('change-workspace');
const workspace = this.getWorkspaceFromId(workspaceID); const workspace = this.getWorkspaceFromId(workspaceID);
await this.changeWorkspace(workspace); setTimeout(() => {
this.changeWorkspace(workspace);
}, 0);
} }
return; return;
} }

View File

@@ -19,7 +19,7 @@
"brandShortName": "Zen", "brandShortName": "Zen",
"brandFullName": "Zen Browser", "brandFullName": "Zen Browser",
"release": { "release": {
"displayVersion": "1.16.3b", "displayVersion": "1.16.4b",
"github": { "github": {
"repo": "zen-browser/desktop" "repo": "zen-browser/desktop"
}, },