1
0
Fork 1
mirror of https://github.com/zen-browser/desktop.git synced 2025-07-08 08:19:59 +02:00

Merge branch 'dev' into startup-autofocus-toggle

This commit is contained in:
mr. m 2025-06-12 19:09:18 +02:00 committed by GitHub
commit ada8489cc7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
39 changed files with 646 additions and 772 deletions

2
l10n

@ -1 +1 @@
Subproject commit a98bf797971ff06742aa4179400e18e0fd465946 Subproject commit 80f03d913e3703933e9f4c1099720e112814e953

View file

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this // 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/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
pref("general.smoothScroll.msdPhysics.enabled", true);
pref("general.smoothScroll.currentVelocityWeighting", "0.15"); pref("general.smoothScroll.currentVelocityWeighting", "0.15");
pref("general.smoothScroll.stopDecelerationWeighting", "0.6"); pref("general.smoothScroll.stopDecelerationWeighting", "0.6");
pref("mousewheel.min_line_scroll_amount", 10); pref("mousewheel.min_line_scroll_amount", 10);

View file

@ -1,3 +1,7 @@
# 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/.
<commandset id="zenCommandSet"> <commandset id="zenCommandSet">
<command id="cmd_zenCompactModeToggle" /> <command id="cmd_zenCompactModeToggle" />
<command id="cmd_zenCompactModeShowSidebar" /> <command id="cmd_zenCompactModeShowSidebar" />
@ -39,7 +43,7 @@
<command id="cmd_zenCtxDeleteWorkspace" /> <command id="cmd_zenCtxDeleteWorkspace" />
<command id="cmd_zenChangeWorkspaceName" /> <command id="cmd_zenChangeWorkspaceName" />
<command id="cmd_zenChangeWorkspaceIcon" /> <command id="cmd_zenChangeWorkspaceIcon" />
<command id="cmd_zenOpenWorkspacePanel" /> <command id="cmd_zenReorderWorkspaces" />
<command id="cmd_zenOpenWorkspaceCreation" /> <command id="cmd_zenOpenWorkspaceCreation" />
<command id="cmd_zenPinnedTabReset" /> <command id="cmd_zenPinnedTabReset" />

View file

@ -1,3 +1,6 @@
# 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/.
<link rel="localization" href="browser/zen-workspaces.ftl"/> <link rel="localization" href="browser/zen-workspaces.ftl"/>
<link rel="localization" href="browser/zen-split-view.ftl"/> <link rel="localization" href="browser/zen-split-view.ftl"/>

View file

@ -0,0 +1,11 @@
# 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/.
<panel type="arrow" orient="vertical" id="PanelUI-zen-emojis-picker" position="bottomright topright" side="bottom">
<hbox id="PanelUI-zen-emojis-picker-header">
<html:input type="search" id="PanelUI-zen-emojis-picker-search" placeholder="Search emojis" />
<toolbarbutton id="PanelUI-zen-emojis-picker-none" class="toolbarbutton-1" />
</hbox>
<hbox id="PanelUI-zen-emojis-picker-list" />
</panel>

View file

@ -0,0 +1,61 @@
# 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/.
<panel flip="side" type="arrow" popupalign="center" orient="vertical" id="PanelUI-zen-gradient-generator" position="bottomright topright" mainview="true" side="left">
<panelmultiview id="PanelUI-zen-gradient-generator-multiview" mainViewId="PanelUI-zen-gradient-generator-view">
<panelview id="PanelUI-zen-gradient-generator-view" class="PanelUI-subView zen-theme-picker" role="document" mainview-with-header="true" has-custom-header="true">
<hbox>
<hbox id="PanelUI-zen-gradient-generator-predefined">
<box data-algo="analogous" data-num-dots="3" data-position="219,99" style="background: linear-gradient(135deg, rgb(117, 255, 136), rgb(60, 66, 58));"></box>
<box data-algo="analogous" data-num-dots="3" data-position="167,201" style="background: linear-gradient(135deg, #a03fe0, #382b5c);"></box>
<box data-algo="analogous" data-num-dots="3" data-position="90,170" style="background: linear-gradient(135deg, #c57aa3, #af824f);"></box>
<box data-algo="splitComplementary" data-num-dots="3" data-position="83,103" style="background: linear-gradient(135deg, #1e90ff, #968a4a);"></box>
<box data-algo="analogous" data-num-dots="3" data-position="186,186" style="background: linear-gradient(135deg, #a07a48, #ab80e4);"></box>
<box data-algo="float" data-num-dots="1" data-position="196,176" style="background: #7bcbda;"></box>
<box data-algo="float" data-num-dots="1" data-position="116,167" style="background: #be9ac9;"></box>
<box data-algo="float" data-num-dots="1" data-position="122,110" style="background: #cdcea1;"></box>
<box data-algo="float" data-num-dots="1" data-position="181,83" style="background: #6ac593;"></box>
<box data-algo="complementary" data-num-dots="2" data-position="82,112" style="background: linear-gradient(135deg, #1e90ff, #cfb179);"></box>
</hbox>
</hbox>
<hbox class="zen-theme-picker-gradient">
<box id="PanelUI-zen-gradient-generator-rotation-dot"></box>
<box id="PanelUI-zen-gradient-generator-rotation-line"></box>
<box id="PanelUI-zen-gradient-generator-color-actions">
<button id="PanelUI-zen-gradient-generator-color-add" class="subviewbutton">
</button>
<button id="PanelUI-zen-gradient-generator-color-remove" class="subviewbutton">
</button>
<html:div class="separator"></html:div>
<button id="PanelUI-zen-gradient-generator-color-toggle-algo" class="subviewbutton" data-l10n-id="zen-panel-ui-gradient-generator-algo-floating">
</button>
</box>
<label data-l10n-id="zen-panel-ui-gradient-click-to-add" id="PanelUI-zen-gradient-generator-color-click-to-add"></label>
</hbox>
<hbox id="PanelUI-zen-gradient-generator-controls">
<hbox id="PanelUI-zen-gradient-colors-wrapper">
<vbox flex="1">
<label data-l10n-id="zen-panel-ui-gradient-generator-opacity-text"></label>
<html:input type="range" min="0" max="1" value="0.5" step="0.05" id="PanelUI-zen-gradient-generator-opacity" />
</vbox>
<vbox id="PanelUI-zen-gradient-generator-texture-wrapper">
</vbox>
</hbox>
</hbox>
<vbox id="PanelUI-zen-gradient-generator-custom-colors">
<vbox id="zen-theme-picker-color">
<label data-l10n-id="zen-panel-ui-gradient-generator-custom-color"></label>
<hbox>
<html:input type="text" placeholder="#000000" id="PanelUI-zen-gradient-generator-custom-input" />
<toolbarbutton id="PanelUI-zen-gradient-generator-color-custom-add" class="subviewbutton">
<image></image>
</toolbarbutton>
</hbox>
</vbox>
<vbox id="PanelUI-zen-gradient-generator-custom-list">
</vbox>
</vbox>
</panelview>
</panelmultiview>
</panel>

View file

@ -0,0 +1,29 @@
# 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/.
<menupopup id="zenCreateNewPopup">
<menuitem data-l10n-id="tabs-toolbar-new-tab" command="cmd_newNavigatorTab" image="chrome://browser/skin/zen-icons/plus.svg" />
<menuseparator/>
<menuitem data-l10n-id="zen-panel-ui-workspaces-create" command="cmd_zenOpenWorkspaceCreation" image="chrome://browser/skin/zen-icons/duplicate-tab.svg" />
</menupopup>
<menupopup id="zenWorkspaceMoreActions">
<menuitem id="context_zenEditWorkspace" data-l10n-id="zen-workspaces-panel-change-name" command="cmd_zenChangeWorkspaceName"/>
<menuitem id="context_zenEditWorkspaceIcon" data-l10n-id="zen-workspaces-panel-change-icon" command="cmd_zenChangeWorkspaceIcon"/>
<menuitem class="zenToolbarThemePicker"
data-l10n-id="zen-workspaces-change-theme"
command="cmd_zenOpenZenThemePicker"/>
<menu id="context_zenWorkspacesOpenInContainerTab"
data-l10n-id="zen-workspaces-panel-context-default-profile"
selection-type="single"
node-type="link"
hide-if-private-browsing="true"
hide-if-usercontext-disabled="true">
<menupopup />
</menu>
<menuseparator/>
<menuitem id="context_zenReorderWorkspaces" data-l10n-id="zen-workspaces-panel-context-reorder" command="cmd_zenReorderWorkspaces"/>
<menuseparator/>
<menuitem id="context_zenDeleteWorkspace" data-l10n-id="zen-workspaces-panel-context-delete" command="cmd_zenCtxDeleteWorkspace"/>
</menupopup>

View file

@ -1,112 +1,8 @@
# 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/.
<panel flip="side" type="arrow" orient="vertical" id="PanelUI-zen-gradient-generator" position="bottomright topright" mainview="true" side="left"> #include zen-panels/gradient-generator.inc
<panelmultiview id="PanelUI-zen-gradient-generator-multiview" mainViewId="PanelUI-zen-gradient-generator-view"> #include zen-panels/emojis-picker.inc
<panelview id="PanelUI-zen-gradient-generator-view" class="PanelUI-subView zen-theme-picker" role="document" mainview-with-header="true" has-custom-header="true">
<hbox>
<hbox id="PanelUI-zen-gradient-generator-predefined">
<box data-algo="analogous" data-num-dots="3" data-position="219,99" style="background: linear-gradient(135deg, rgb(117, 255, 136), rgb(60, 66, 58));"></box>
<box data-algo="analogous" data-num-dots="3" data-position="167,201" style="background: linear-gradient(135deg, #a03fe0, #382b5c);"></box>
<box data-algo="analogous" data-num-dots="3" data-position="90,170" style="background: linear-gradient(135deg, #c57aa3, #af824f);"></box>
<box data-algo="splitComplementary" data-num-dots="3" data-position="83,103" style="background: linear-gradient(135deg, #1e90ff, #968a4a);"></box>
<box data-algo="analogous" data-num-dots="3" data-position="186,186" style="background: linear-gradient(135deg, #a07a48, #ab80e4);"></box>
<box data-algo="float" data-num-dots="1" data-position="196,176" style="background: #7bcbda;"></box>
<box data-algo="float" data-num-dots="1" data-position="116,167" style="background: #be9ac9;"></box>
<box data-algo="float" data-num-dots="1" data-position="122,110" style="background: #cdcea1;"></box>
<box data-algo="float" data-num-dots="1" data-position="181,83" style="background: #6ac593;"></box>
<box data-algo="complementary" data-num-dots="2" data-position="82,112" style="background: linear-gradient(135deg, #1e90ff, #cfb179);"></box>
</hbox>
</hbox>
<hbox class="zen-theme-picker-gradient">
<box id="PanelUI-zen-gradient-generator-rotation-dot"></box>
<box id="PanelUI-zen-gradient-generator-rotation-line"></box>
<box id="PanelUI-zen-gradient-generator-color-actions">
<button id="PanelUI-zen-gradient-generator-color-add" class="subviewbutton">
</button>
<button id="PanelUI-zen-gradient-generator-color-remove" class="subviewbutton">
</button>
<html:div class="separator"></html:div>
<button id="PanelUI-zen-gradient-generator-color-toggle-algo" class="subviewbutton" data-l10n-id="zen-panel-ui-gradient-generator-algo-floating">
</button>
</box>
<label data-l10n-id="zen-panel-ui-gradient-click-to-add" id="PanelUI-zen-gradient-generator-color-click-to-add"></label>
</hbox>
<hbox id="PanelUI-zen-gradient-generator-controls">
<hbox id="PanelUI-zen-gradient-colors-wrapper">
<vbox flex="1">
<label data-l10n-id="zen-panel-ui-gradient-generator-opacity-text"></label>
<html:input type="range" min="0" max="1" value="0.5" step="0.05" id="PanelUI-zen-gradient-generator-opacity" />
</vbox>
<vbox id="PanelUI-zen-gradient-generator-texture-wrapper">
</vbox>
</hbox>
</hbox>
<vbox id="PanelUI-zen-gradient-generator-custom-colors">
<vbox id="zen-theme-picker-color">
<label data-l10n-id="zen-panel-ui-gradient-generator-custom-color"></label>
<hbox>
<html:input type="text" placeholder="#000000" id="PanelUI-zen-gradient-generator-custom-input" />
<toolbarbutton id="PanelUI-zen-gradient-generator-color-custom-add" class="subviewbutton">
<image></image>
</toolbarbutton>
</hbox>
</vbox>
<vbox id="PanelUI-zen-gradient-generator-custom-list">
</vbox>
</vbox>
</panelview>
</panelmultiview>
</panel>
<panel flip="slide" type="arrow" orient="vertical" id="PanelUI-zen-workspaces" position="bottomright topright" mainview="true" side="left"> #include zen-panels/popups.inc
<panelmultiview id="PanelUI-zen-workspaces-multiview" mainViewId="PanelUI-zen-workspaces-view">
<panelview id="PanelUI-zen-workspaces-view" class="PanelUI-subView" role="document" mainview-with-header="true" has-custom-header="true" closemenu="none">
<vbox>
<hbox>
<h3 data-l10n-id="zen-panel-ui-workspaces-text" id="PanelUI-zen-workspaces-header"></h3>
<toolbarbutton id="PanelUI-zen-workspaces-reorder-mode" class="subviewbutton">
<image></image>
</toolbarbutton>
<toolbarbutton id="PanelUI-zen-workspaces-new" class="subviewbutton" command="cmd_zenOpenWorkspaceCreation">
<image></image>
</toolbarbutton>
</hbox>
</vbox>
<html:div id="PanelUI-zen-workspaces-list">
</html:div>
</panelview>
</panelmultiview>
</panel>
<panel type="arrow" orient="vertical" id="PanelUI-zen-emojis-picker" position="bottomright topright" side="bottom">
<hbox id="PanelUI-zen-emojis-picker-header">
<html:input type="search" id="PanelUI-zen-emojis-picker-search" placeholder="Search emojis" />
<toolbarbutton id="PanelUI-zen-emojis-picker-none" class="toolbarbutton-1" />
</hbox>
<hbox id="PanelUI-zen-emojis-picker-list" />
</panel>
<menupopup id="zenCreateNewPopup">
<menuitem data-l10n-id="tabs-toolbar-new-tab" command="cmd_newNavigatorTab" image="chrome://browser/skin/zen-icons/plus.svg" />
<menuseparator/>
<menuitem data-l10n-id="zen-panel-ui-workspaces-create" command="cmd_zenOpenWorkspaceCreation" image="chrome://browser/skin/zen-icons/duplicate-tab.svg" />
</menupopup>
<menupopup id="zenWorkspaceMoreActions">
<menuitem id="context_zenEditWorkspace" data-l10n-id="zen-panel-ui-workspaces-create" command="cmd_zenChangeWorkspaceName"/>
<menuitem id="context_zenEditWorkspaceIcon" data-l10n-id="zen-workspaces-panel-change-icon" command="cmd_zenChangeWorkspaceIcon"/>
<menuitem class="zenToolbarThemePicker"
data-l10n-id="zen-workspaces-change-theme"
command="cmd_zenOpenZenThemePicker"/>
<menu id="context_zenWorkspacesOpenInContainerTab"
data-l10n-id="zen-workspaces-panel-context-open-in-container-tab"
selection-type="single"
node-type="link"
hide-if-private-browsing="true"
hide-if-usercontext-disabled="true">
<menupopup />
</menu>
<menuseparator/>
<menuitem id="context_zenOpenWorkspacePanel" data-l10n-id="zen-workspaces-panel-context-manage" command="cmd_zenOpenWorkspacePanel"/>
<menuseparator/>
<menuitem id="context_zenDeleteWorkspace" data-l10n-id="zen-workspaces-panel-context-delete" command="cmd_zenCtxDeleteWorkspace"/>
</menupopup>

View file

@ -1,3 +1,7 @@
# 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/.
# This needs to be here, before all the other scripts, because it's used before # This needs to be here, before all the other scripts, because it's used before
# the window is fully loaded. # the window is fully loaded.
# Make sure they are loaded before the global-scripts.inc file. # Make sure they are loaded before the global-scripts.inc file.

View file

@ -1,6 +1,11 @@
# 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/.
#include ../../../zen/media/zen-media-controls.inc.xhtml #include ../../../zen/media/zen-media-controls.inc.xhtml
<toolbar brighttext="true" <toolbar brighttext="true"
id="zen-sidebar-bottom-buttons" id="zen-sidebar-foot-buttons"
fullscreentoolbar="true" fullscreentoolbar="true"
class="browser-toolbar customization-target" class="browser-toolbar customization-target"
data-l10n-id="tabs-toolbar" data-l10n-id="tabs-toolbar"

View file

@ -1,3 +1,7 @@
# 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/.
<vbox id="zen-toast-container"></vbox> <vbox id="zen-toast-container"></vbox>
#include ../../../zen/split-view/zen-splitview-overlay.inc.xhtml #include ../../../zen/split-view/zen-splitview-overlay.inc.xhtml

View file

@ -1,5 +1,5 @@
diff --git a/browser/components/tabbrowser/content/tabs.js b/browser/components/tabbrowser/content/tabs.js diff --git a/browser/components/tabbrowser/content/tabs.js b/browser/components/tabbrowser/content/tabs.js
index 84d633471c89230b981d8a07babef4e0c76c0338..de8b1ecf7cb844f6cf3e66a41b6024c574dfc103 100644 index 84d633471c89230b981d8a07babef4e0c76c0338..a4101ad4e8aa9745ec807eb0373942b53c8dd285 100644
--- a/browser/components/tabbrowser/content/tabs.js --- a/browser/components/tabbrowser/content/tabs.js
+++ b/browser/components/tabbrowser/content/tabs.js +++ b/browser/components/tabbrowser/content/tabs.js
@@ -83,7 +83,7 @@ @@ -83,7 +83,7 @@
@ -116,6 +116,15 @@ index 84d633471c89230b981d8a07babef4e0c76c0338..de8b1ecf7cb844f6cf3e66a41b6024c5
lastBound lastBound
); );
} else { } else {
@@ -1168,7 +1192,7 @@
(oldTranslateX && oldTranslateX != newTranslateX) ||
(oldTranslateY && oldTranslateY != newTranslateY);
} else if (this.verticalMode) {
- shouldTranslate &&= oldTranslateY && oldTranslateY != newTranslateY;
+ shouldTranslate &&= oldTranslateY && oldTranslateY != newTranslateY && movingTabs.length === 1;
} else {
shouldTranslate &&= oldTranslateX && oldTranslateX != newTranslateX;
}
@@ -1337,6 +1361,7 @@ @@ -1337,6 +1361,7 @@
let nextItem = this.ariaFocusableItems[newIndex]; let nextItem = this.ariaFocusableItems[newIndex];

View file

@ -1,5 +1,5 @@
diff --git a/browser/components/urlbar/UrlbarInput.sys.mjs b/browser/components/urlbar/UrlbarInput.sys.mjs diff --git a/browser/components/urlbar/UrlbarInput.sys.mjs b/browser/components/urlbar/UrlbarInput.sys.mjs
index 0c5145c3d31862bd2c6b5ed2faa88f02425ffde1..1cf86995514b2c00360f6ed681f0c640dac8ab56 100644 index 0c5145c3d31862bd2c6b5ed2faa88f02425ffde1..370bd107be760893516360bd85553acb6533774b 100644
--- a/browser/components/urlbar/UrlbarInput.sys.mjs --- a/browser/components/urlbar/UrlbarInput.sys.mjs
+++ b/browser/components/urlbar/UrlbarInput.sys.mjs +++ b/browser/components/urlbar/UrlbarInput.sys.mjs
@@ -68,6 +68,13 @@ XPCOMUtils.defineLazyPreferenceGetter( @@ -68,6 +68,13 @@ XPCOMUtils.defineLazyPreferenceGetter(
@ -187,7 +187,15 @@ index 0c5145c3d31862bd2c6b5ed2faa88f02425ffde1..1cf86995514b2c00360f6ed681f0c640
let controller = let controller =
this.document.commandDispatcher.getControllerForCommand("cmd_paste"); this.document.commandDispatcher.getControllerForCommand("cmd_paste");
@@ -4136,6 +4204,11 @@ export class UrlbarInput { @@ -4025,6 +4093,7 @@ export class UrlbarInput {
_setPlaceholder(name) {
this.document.l10n.setAttributes(
this.inputField,
+ this.window.gZenVerticalTabsManager._hasSetSingleToolbar ? 'zen-singletoolbar-urlbar-placeholder-with-name' :
name ? "urlbar-placeholder-with-name" : "urlbar-placeholder",
name ? { name } : undefined
);
@@ -4136,6 +4205,11 @@ export class UrlbarInput {
} }
_on_click(event) { _on_click(event) {
@ -199,7 +207,7 @@ index 0c5145c3d31862bd2c6b5ed2faa88f02425ffde1..1cf86995514b2c00360f6ed681f0c640
if ( if (
event.target == this.inputField || event.target == this.inputField ||
event.target == this._inputContainer || event.target == this._inputContainer ||
@@ -4207,7 +4280,7 @@ export class UrlbarInput { @@ -4207,7 +4281,7 @@ export class UrlbarInput {
} }
} }
@ -208,7 +216,7 @@ index 0c5145c3d31862bd2c6b5ed2faa88f02425ffde1..1cf86995514b2c00360f6ed681f0c640
this.view.autoOpen({ event }); this.view.autoOpen({ event });
} else { } else {
if (this._untrimOnFocusAfterKeydown) { if (this._untrimOnFocusAfterKeydown) {
@@ -4247,9 +4320,16 @@ export class UrlbarInput { @@ -4247,9 +4321,16 @@ export class UrlbarInput {
} }
_on_mousedown(event) { _on_mousedown(event) {
@ -226,7 +234,7 @@ index 0c5145c3d31862bd2c6b5ed2faa88f02425ffde1..1cf86995514b2c00360f6ed681f0c640
if ( if (
event.target != this.inputField && event.target != this.inputField &&
@@ -4261,6 +4341,10 @@ export class UrlbarInput { @@ -4261,6 +4342,10 @@ export class UrlbarInput {
this.focusedViaMousedown = !this.focused; this.focusedViaMousedown = !this.focused;
this._preventClickSelectsAll = this.focused; this._preventClickSelectsAll = this.focused;
@ -237,7 +245,7 @@ index 0c5145c3d31862bd2c6b5ed2faa88f02425ffde1..1cf86995514b2c00360f6ed681f0c640
// Keep the focus status, since the attribute may be changed // Keep the focus status, since the attribute may be changed
// upon calling this.focus(). // upon calling this.focus().
@@ -4301,7 +4385,7 @@ export class UrlbarInput { @@ -4301,7 +4386,7 @@ export class UrlbarInput {
} }
// Don't close the view when clicking on a tab; we may want to keep the // Don't close the view when clicking on a tab; we may want to keep the
// view open on tab switch, and the TabSelect event arrived earlier. // view open on tab switch, and the TabSelect event arrived earlier.

View file

@ -39,11 +39,14 @@
.close-icon, .close-icon,
#zen-sidebar-web-panel-close, #zen-sidebar-web-panel-close,
#zen-glance-sidebar-close, #zen-glance-sidebar-close,
#PanelUI-zen-emojis-picker-none,
.zen-theme-picker-custom-list-item-remove { .zen-theme-picker-custom-list-item-remove {
list-style-image: url('close.svg') !important; list-style-image: url('close.svg') !important;
} }
#PanelUI-zen-emojis-picker-none {
list-style-image: url('trash.svg');
}
.reset-icon { .reset-icon {
list-style-image: url('reload.svg') !important; list-style-image: url('reload.svg') !important;
} }
@ -185,16 +188,10 @@
#appMenu-zoomEnlarge-button2, #appMenu-zoomEnlarge-button2,
#PanelUI-zen-profiles-newProfile, #PanelUI-zen-profiles-newProfile,
#zen-sidebar-add-panel-button, #zen-sidebar-add-panel-button,
#PanelUI-zen-workspaces-new image,
#PanelUI-zen-gradient-generator-color-custom-add image { #PanelUI-zen-gradient-generator-color-custom-add image {
list-style-image: url('plus.svg') !important; list-style-image: url('plus.svg') !important;
} }
#PanelUI-zen-workspaces-reorder-mode image {
list-style-image: url('move-tab.svg') !important;
rotate: 90deg;
}
#cut-button { #cut-button {
list-style-image: url('edit-cut.svg') !important; list-style-image: url('edit-cut.svg') !important;
} }

View file

@ -126,6 +126,7 @@
skin/classic/browser/zen-icons/tool-profiler.svg (../shared/zen-icons/lin/tool-profiler.svg) skin/classic/browser/zen-icons/tool-profiler.svg (../shared/zen-icons/lin/tool-profiler.svg)
skin/classic/browser/zen-icons/tracking-protection.svg (../shared/zen-icons/lin/tracking-protection.svg) skin/classic/browser/zen-icons/tracking-protection.svg (../shared/zen-icons/lin/tracking-protection.svg)
skin/classic/browser/zen-icons/translations.svg (../shared/zen-icons/lin/translations.svg) skin/classic/browser/zen-icons/translations.svg (../shared/zen-icons/lin/translations.svg)
skin/classic/browser/zen-icons/trash.svg (../shared/zen-icons/lin/trash.svg)
skin/classic/browser/zen-icons/unpin.svg (../shared/zen-icons/lin/unpin.svg) skin/classic/browser/zen-icons/unpin.svg (../shared/zen-icons/lin/unpin.svg)
skin/classic/browser/zen-icons/video-blocked-fill.svg (../shared/zen-icons/lin/video-blocked-fill.svg) skin/classic/browser/zen-icons/video-blocked-fill.svg (../shared/zen-icons/lin/video-blocked-fill.svg)
skin/classic/browser/zen-icons/video-fill.svg (../shared/zen-icons/lin/video-fill.svg) skin/classic/browser/zen-icons/video-fill.svg (../shared/zen-icons/lin/video-fill.svg)
@ -264,6 +265,7 @@
skin/classic/browser/zen-icons/tool-profiler.svg (../shared/zen-icons/lin/tool-profiler.svg) skin/classic/browser/zen-icons/tool-profiler.svg (../shared/zen-icons/lin/tool-profiler.svg)
skin/classic/browser/zen-icons/tracking-protection.svg (../shared/zen-icons/lin/tracking-protection.svg) skin/classic/browser/zen-icons/tracking-protection.svg (../shared/zen-icons/lin/tracking-protection.svg)
skin/classic/browser/zen-icons/translations.svg (../shared/zen-icons/lin/translations.svg) skin/classic/browser/zen-icons/translations.svg (../shared/zen-icons/lin/translations.svg)
skin/classic/browser/zen-icons/trash.svg (../shared/zen-icons/lin/trash.svg)
skin/classic/browser/zen-icons/unpin.svg (../shared/zen-icons/lin/unpin.svg) skin/classic/browser/zen-icons/unpin.svg (../shared/zen-icons/lin/unpin.svg)
skin/classic/browser/zen-icons/video-blocked-fill.svg (../shared/zen-icons/lin/video-blocked-fill.svg) skin/classic/browser/zen-icons/video-blocked-fill.svg (../shared/zen-icons/lin/video-blocked-fill.svg)
skin/classic/browser/zen-icons/video-fill.svg (../shared/zen-icons/lin/video-fill.svg) skin/classic/browser/zen-icons/video-fill.svg (../shared/zen-icons/lin/video-fill.svg)
@ -402,6 +404,7 @@
skin/classic/browser/zen-icons/tool-profiler.svg (../shared/zen-icons/lin/tool-profiler.svg) skin/classic/browser/zen-icons/tool-profiler.svg (../shared/zen-icons/lin/tool-profiler.svg)
skin/classic/browser/zen-icons/tracking-protection.svg (../shared/zen-icons/lin/tracking-protection.svg) skin/classic/browser/zen-icons/tracking-protection.svg (../shared/zen-icons/lin/tracking-protection.svg)
skin/classic/browser/zen-icons/translations.svg (../shared/zen-icons/lin/translations.svg) skin/classic/browser/zen-icons/translations.svg (../shared/zen-icons/lin/translations.svg)
skin/classic/browser/zen-icons/trash.svg (../shared/zen-icons/lin/trash.svg)
skin/classic/browser/zen-icons/unpin.svg (../shared/zen-icons/lin/unpin.svg) skin/classic/browser/zen-icons/unpin.svg (../shared/zen-icons/lin/unpin.svg)
skin/classic/browser/zen-icons/video-blocked-fill.svg (../shared/zen-icons/lin/video-blocked-fill.svg) skin/classic/browser/zen-icons/video-blocked-fill.svg (../shared/zen-icons/lin/video-blocked-fill.svg)
skin/classic/browser/zen-icons/video-fill.svg (../shared/zen-icons/lin/video-fill.svg) skin/classic/browser/zen-icons/video-fill.svg (../shared/zen-icons/lin/video-fill.svg)

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="18px" height="18px" viewBox="0 0 18 18"><path d="m13.474,7.25l-.374,7.105c-.056,1.062-.934,1.895-1.997,1.895h-4.205c-1.064,0-1.941-.833-1.997-1.895l-.374-7.105" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path><line x1="2.75" y1="4.75" x2="15.25" y2="4.75" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" data-color="color-2"></line><path d="m6.75,4.75v-2c0-.552.448-1,1-1h2.5c.552,0,1,.448,1,1v2" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" data-color="color-2"></path></svg>

After

Width:  |  Height:  |  Size: 748 B

View file

@ -20,7 +20,7 @@ export var ZenCustomizableUI = new (class {
true true
); );
CustomizableUIInternal.registerArea( CustomizableUIInternal.registerArea(
'zen-sidebar-bottom-buttons', 'zen-sidebar-foot-buttons',
{ {
type: this.TYPE_TOOLBAR, type: this.TYPE_TOOLBAR,
defaultPlacements: this.defaultSidebarIcons, defaultPlacements: this.defaultSidebarIcons,
@ -107,6 +107,9 @@ 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', () => {
if (button.hasAttribute('open')) {
return;
}
const image = button.querySelector('image'); const image = button.querySelector('image');
const popup = window.document.getElementById('zenCreateNewPopup'); const popup = window.document.getElementById('zenCreateNewPopup');
button.setAttribute('open', 'true'); button.setAttribute('open', 'true');
@ -148,7 +151,7 @@ export var ZenCustomizableUI = new (class {
} }
_hideToolbarButtons(window) { _hideToolbarButtons(window) {
const wrapper = window.document.getElementById('zen-sidebar-bottom-buttons'); const wrapper = window.document.getElementById('zen-sidebar-foot-buttons');
const elementsToHide = ['new-tab-button']; const elementsToHide = ['new-tab-button'];
for (let id of elementsToHide) { for (let id of elementsToHide) {
const elem = window.document.getElementById(id); const elem = window.document.getElementById(id);
@ -167,7 +170,7 @@ export var ZenCustomizableUI = new (class {
window.document.getElementById('zen-sidebar-top-buttons') window.document.getElementById('zen-sidebar-top-buttons')
); );
window.CustomizableUI.registerToolbarNode( window.CustomizableUI.registerToolbarNode(
window.document.getElementById('zen-sidebar-bottom-buttons') window.document.getElementById('zen-sidebar-foot-buttons')
); );
} }
})(); })();

View file

@ -967,16 +967,23 @@ var gZenVerticalTabsManager = {
gZenCompactModeManager.getAndApplySidebarWidth(); gZenCompactModeManager.getAndApplySidebarWidth();
} }
gZenUIManager.updateTabsToolbar(); gZenUIManager.updateTabsToolbar();
this.rebuildURLBarMenus();
gURLBar._initCopyCutController();
gURLBar._initPasteAndGo();
gURLBar._initStripOnShare();
} catch (e) { } catch (e) {
console.error(e); console.error(e);
} }
this._isUpdating = false; this._isUpdating = false;
}, },
rebuildURLBarMenus() {
if (document.getElementById('paste-and-go')) {
return;
}
gURLBar._initCopyCutController();
gURLBar._initPasteAndGo();
gURLBar._initStripOnShare();
gURLBar._updatePlaceholderFromDefaultEngine();
},
rebuildAreas() { rebuildAreas() {
CustomizableUI.zenInternalCU._rebuildRegisteredAreas(/* zenDontRebuildCollapsed */ true); CustomizableUI.zenInternalCU._rebuildRegisteredAreas(/* zenDontRebuildCollapsed */ true);
}, },

View file

@ -81,8 +81,10 @@
} }
} }
#onPopupShowing(event) { // note: It's async on purpose so we can render the popup before processing the emojis
async #onPopupShowing(event) {
if (event.target !== this.#panel) return; if (event.target !== this.#panel) return;
this.searchInput.value = '';
const emojiList = this.emojiList; const emojiList = this.emojiList;
for (const emoji of this.#emojis) { for (const emoji of this.#emojis) {
const item = document.createXULElement('toolbarbutton'); const item = document.createXULElement('toolbarbutton');
@ -94,6 +96,9 @@
}); });
emojiList.appendChild(item); emojiList.appendChild(item);
} }
setTimeout(() => {
this.searchInput.focus();
}, 500);
} }
#onPopupHidden(event) { #onPopupHidden(event) {

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,56 @@
import os
import requests
import json
def get_emojis(url):
"""
Fetches emojis from the given URL and formats them into a JavaScript module.
Args:
url (str): The URL to fetch the emoji data from.
Returns:
array: A JavaScript array of emoji objects formatted for use in a module.
"""
response = requests.get(url)
response.raise_for_status() # Raise an error for bad responses
emojis_data = response.json()
# We only want "tags", "emoji" amd "order" from the dictionaries inside this array
emojis = []
for emoji in emojis_data:
emojis.append({
"tags": emoji.get("tags", []),
"order": emoji.get("order", 0),
"emoji": emoji.get("emoji", "")
})
return emojis
def get_js_code(emojis):
"""
Generates JavaScript code to export the emojis as a module.
Args:
emojis (list): A list of emoji dictionaries.
Returns:
str: JavaScript code as a string.
"""
js_code = "var ZenEmojisData = "
# dump without unicode escape
js_code += json.dumps(emojis, ensure_ascii=False)
return js_code
if __name__ == "__main__":
# Define the URL for the emoji JSON file
url = "https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json"
emojis_path = os.path.join(os.path.dirname(__file__), "ZenEmojisData.min.mjs")
emojis = get_emojis(url)
js_code = get_js_code(emojis)
with open(emojis_path, "w", encoding="utf-8") as file:
file.write(js_code)
print(f"Emojis data has been written to {emojis_path}")

View file

@ -400,6 +400,8 @@ menuseparator {
min-width: unset !important; min-width: unset !important;
margin: 0px !important; margin: 0px !important;
border-radius: calc(var(--zen-native-inner-radius) + 2px) !important; border-radius: calc(var(--zen-native-inner-radius) + 2px) !important;
background: light-dark(rgba(255, 255, 255, 0.1), rgba(0, 0, 0, 0.1)) !important;
border: 1px solid light-dark(rgba(255, 255, 255, 0.15), rgba(0, 0, 0, 0.15)) !important;
:root[zen-right-side='true'] & { :root[zen-right-side='true'] & {
order: -1; order: -1;

View file

@ -40,15 +40,13 @@ body > #confetti {
#PanelUI-zen-emojis-picker { #PanelUI-zen-emojis-picker {
--panel-width: 250px; --panel-width: 250px;
--panel-padding: 10px; --panel-padding: 0px;
&::part(content) {
gap: 15px;
}
#PanelUI-zen-emojis-picker-header { #PanelUI-zen-emojis-picker-header {
gap: 10px; gap: 10px;
align-items: center; align-items: center;
padding: 10px;
padding-bottom: 5px;
} }
#PanelUI-zen-emojis-picker-none label { #PanelUI-zen-emojis-picker-none label {
@ -57,6 +55,7 @@ body > #confetti {
#PanelUI-zen-emojis-picker-search { #PanelUI-zen-emojis-picker-search {
padding: 4px; padding: 4px;
width: 100%;
} }
#PanelUI-zen-emojis-picker-list { #PanelUI-zen-emojis-picker-list {
@ -65,6 +64,9 @@ body > #confetti {
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
padding: 10px;
padding-top: 5px;
gap: 5px; gap: 5px;
display: grid; display: grid;
grid-template-columns: repeat(auto-fill, minmax(28px, 1fr)); grid-template-columns: repeat(auto-fill, minmax(28px, 1fr));
@ -72,6 +74,7 @@ body > #confetti {
.zen-emojis-picker-emoji { .zen-emojis-picker-emoji {
appearance: none; appearance: none;
font-size: 14px; font-size: 14px;
padding: 0px !important;
& image { & image {
display: none; display: none;
} }

View file

@ -101,8 +101,11 @@ document.addEventListener(
case 'cmd_zenChangeWorkspaceIcon': case 'cmd_zenChangeWorkspaceIcon':
gZenWorkspaces.changeWorkspaceIcon(); gZenWorkspaces.changeWorkspaceIcon();
break; break;
case 'cmd_zenOpenWorkspacePanel': case 'cmd_zenReorderWorkspaces':
gZenWorkspaces.openWorkspacesDialog(event); gZenUIManager.showToast('zen-workspaces-how-to-reorder-title', {
timeout: 10000,
descriptionId: 'zen-workspaces-how-to-reorder-desc',
});
break; break;
case 'cmd_zenOpenWorkspaceCreation': case 'cmd_zenOpenWorkspaceCreation':
gZenWorkspaces.openWorkspaceCreation(event); gZenWorkspaces.openWorkspaceCreation(event);

View file

@ -36,10 +36,12 @@ var gZenCompactModeManager = {
preInit() { preInit() {
// Remove it before initializing so we can properly calculate the width // Remove it before initializing so we can properly calculate the width
// of the sidebar at startup and avoid overflowing items not being hidden // of the sidebar at startup and avoid overflowing items not being hidden
const isCompactMode = this._wasInCompactMode = Services.xulStore.getValue(
lazyCompactMode.mainAppWrapper.getAttribute('zen-compact-mode') === 'true'; AppConstants.BROWSER_CHROME_URL,
'zen-main-app-wrapper',
'zen-compact-mode'
);
lazyCompactMode.mainAppWrapper.removeAttribute('zen-compact-mode'); lazyCompactMode.mainAppWrapper.removeAttribute('zen-compact-mode');
this._wasInCompactMode = isCompactMode;
this.addContextMenu(); this.addContextMenu();
}, },

View file

@ -228,6 +228,7 @@
} }
) )
.then(() => { .then(() => {
gBrowser.tabContainer._invalidateCachedTabs();
this.#currentBrowser.removeAttribute('animate-glance-open'); this.#currentBrowser.removeAttribute('animate-glance-open');
this.overlay.style.removeProperty('overflow'); this.overlay.style.removeProperty('overflow');
this.browserWrapper.removeAttribute('animate'); this.browserWrapper.removeAttribute('animate');
@ -615,6 +616,7 @@
} }
finishOpeningGlance() { finishOpeningGlance() {
gBrowser.tabContainer._invalidateCachedTabs();
gZenWorkspaces.updateTabsContainers(); gZenWorkspaces.updateTabsContainers();
this.browserWrapper.removeAttribute('animate-full'); this.browserWrapper.removeAttribute('animate-full');
this.overlay.classList.remove('zen-glance-overlay'); this.overlay.classList.remove('zen-glance-overlay');
@ -662,7 +664,7 @@
type: 'spring', type: 'spring',
} }
); );
gZenViewSplitter.deactivateCurrentSplitView(); gZenViewSplitter.deactivateCurrentSplitView({ removeDeckSelected: true });
this.finishOpeningGlance(); this.finishOpeningGlance();
} }

View file

@ -1142,12 +1142,12 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
/** /**
* Deactivates the split view. * Deactivates the split view.
*/ */
deactivateCurrentSplitView() { deactivateCurrentSplitView({ removeDeckSelected = false } = {}) {
if (this.currentView < 0) return; if (this.currentView < 0) return;
this.setTabsDocShellState(this._data[this.currentView].tabs, false); this.setTabsDocShellState(this._data[this.currentView].tabs, false);
for (const tab of this._data[this.currentView].tabs) { for (const tab of this._data[this.currentView].tabs) {
const container = tab.linkedBrowser.closest('.browserSidebarContainer'); const container = tab.linkedBrowser.closest('.browserSidebarContainer');
this.resetContainerStyle(container); this.resetContainerStyle(container, removeDeckSelected);
} }
this.removeSplitters(); this.removeSplitters();
this.tabBrowserPanel.removeAttribute('zen-split-view'); this.tabBrowserPanel.removeAttribute('zen-split-view');
@ -1496,10 +1496,14 @@ class ZenViewSplitter extends ZenDOMOperatedFeature {
* Resets the container style. * Resets the container style.
* *
* @param {Element} container - The container element. * @param {Element} container - The container element.
* @param {boolean} [removeDeckSelected=false] - Whether to remove the 'deck-selected' attribute.
*/ */
resetContainerStyle(container) { resetContainerStyle(container, removeDeckSelected = false) {
container.removeAttribute('zen-split'); container.removeAttribute('zen-split');
container.style.inset = ''; container.style.inset = '';
if (removeDeckSelected) {
container.classList.remove('deck-selected');
}
} }
/** /**

View file

@ -786,6 +786,7 @@
if (!this.enabled) { if (!this.enabled) {
return false; return false;
} }
movingTabs = [...movingTabs];
try { try {
const pinnedTabsTarget = const pinnedTabsTarget =
event.target.closest('.zen-workspace-pinned-tabs-section') || event.target.closest('.zen-workspace-pinned-tabs-section') ||

View file

@ -423,20 +423,18 @@
/* ========================================================================== /* ==========================================================================
Sidebar Bottom Buttons Area Sidebar Bottom Buttons Area
========================================================================== */ ========================================================================== */
#zen-sidebar-bottom-buttons { #zen-sidebar-foot-buttons {
background: transparent; background: transparent;
gap: 5px; /* Spacing between buttons */ gap: 5px;
align-items: center; /* Center vertically */ align-items: center;
padding-top: var(--zen-element-separation); /* Add padding above */ padding-top: var(--zen-element-separation);
--toolbarbutton-inner-padding: 5px; /* Define inner padding for buttons */ --toolbarbutton-inner-padding: 5px;
/* Remove padding from direct children (except workspaces button) */
& > toolbarbutton:not(#zen-workspaces-button) { & > toolbarbutton:not(#zen-workspaces-button) {
padding: 0 !important; padding: 0 !important;
} }
} }
/* Hide the default new tab button container */
#newtab-button-container { #newtab-button-container {
display: none !important; display: none !important;
} }
@ -445,7 +443,6 @@
Tab Arrow Scrollbox Adjustments Tab Arrow Scrollbox Adjustments
========================================================================== */ ========================================================================== */
#tabbrowser-arrowscrollbox { #tabbrowser-arrowscrollbox {
/* Remove gap within the scrollbox part */
&::part(scrollbox) { &::part(scrollbox) {
gap: 0px !important; gap: 0px !important;
} }
@ -561,10 +558,10 @@
} }
/* Style bottom buttons area when expanded */ /* Style bottom buttons area when expanded */
& #zen-sidebar-bottom-buttons { & #zen-sidebar-foot-buttons {
display: flex; display: flex;
flex-direction: row; /* Arrange buttons horizontally */ flex-direction: row;
justify-content: space-between; /* Distribute space */ justify-content: space-between;
width: 100%; width: 100%;
position: relative; position: relative;
} }
@ -780,10 +777,27 @@
} }
/* Ensure bottom buttons container fits content during customization */ /* Ensure bottom buttons container fits content during customization */
:root[customizing] & #zen-sidebar-bottom-buttons { :root[customizing] & #zen-sidebar-foot-buttons {
min-width: unset !important; min-width: unset !important;
} }
#zen-sidebar-foot-buttons {
& > .toolbarbutton-1 {
min-height: var(--tab-min-height);
line-height: var(--tab-label-line-height);
border-radius: var(--border-radius-medium);
padding: 0 calc(var(--tab-inline-padding) - var(--tab-inner-inline-margin));
width: var(--tab-collapsed-background-width);
margin-inline: var(--tab-inner-inline-margin);
& .toolbarbutton-badge-stack {
justify-content: center;
padding: 8px;
width: var(--tab-collapsed-background-width);
}
}
}
/* Center top buttons container */ /* Center top buttons container */
& #zen-sidebar-top-buttons { & #zen-sidebar-top-buttons {
justify-content: center; justify-content: center;
@ -805,7 +819,7 @@
} }
/* Style bottom buttons area when collapsed */ /* Style bottom buttons area when collapsed */
& #zen-sidebar-bottom-buttons { & #zen-sidebar-foot-buttons {
display: flex; display: flex;
flex-direction: column; /* Stack vertically */ flex-direction: column; /* Stack vertically */
padding-top: var(--zen-element-separation); padding-top: var(--zen-element-separation);

1
src/zen/vendor/motion.dep vendored Normal file
View file

@ -0,0 +1 @@
https://cdn.jsdelivr.net/npm/motion@latest/+esm: v12.16.0

File diff suppressed because one or more lines are too long

View file

@ -76,14 +76,13 @@
} }
openThemePicker(event) { openThemePicker(event) {
const target = event.explicitOriginalTarget?.classList?.contains( const fromForm = event.explicitOriginalTarget?.classList?.contains(
'zen-workspace-creation-edit-theme-button' 'zen-workspace-creation-edit-theme-button'
) );
? event.explicitOriginalTarget PanelMultiView.openPopup(this.panel, this.toolbox, {
: this.toolbox; position: 'topright topleft',
PanelMultiView.openPopup(this.panel, target, {
position: 'bottomright topright',
triggerEvent: event, triggerEvent: event,
y: fromForm ? -160 : 0,
}); });
} }

View file

@ -72,6 +72,13 @@
.querySelector('.zen-workspaces-actions') .querySelector('.zen-workspaces-actions')
.addEventListener('click', this.onActionsCommand.bind(this)); .addEventListener('click', this.onActionsCommand.bind(this));
this.indicator
.querySelector('.zen-current-workspace-indicator-icon')
.addEventListener('dblclick', (event) => {
event.stopPropagation();
gZenWorkspaces.changeWorkspaceIcon();
});
this.scrollbox._getScrollableElements = () => { this.scrollbox._getScrollableElements = () => {
const children = [...this.pinnedTabsContainer.children, ...this.tabsContainer.children]; const children = [...this.pinnedTabsContainer.children, ...this.tabsContainer.children];
if (Services.prefs.getBoolPref('zen.view.show-newtab-button-top', false)) { if (Services.prefs.getBoolPref('zen.view.show-newtab-button-top', false)) {

View file

@ -23,8 +23,10 @@
<vbox class="zen-workspace-creation" flex="1"> <vbox class="zen-workspace-creation" flex="1">
<form> <form>
<vbox> <vbox>
<html:h1 data-l10n-id="zen-workspace-creation-title" class="zen-workspace-creation-title" /> <html:h1 data-l10n-id="zen-workspace-creation-header" class="zen-workspace-creation-title" />
<html:div>
<label data-l10n-id="zen-workspace-creation-label" class="zen-workspace-creation-label" /> <label data-l10n-id="zen-workspace-creation-label" class="zen-workspace-creation-label" />
</html:div>
</vbox> </vbox>
<vbox class="zen-workspace-creation-form"> <vbox class="zen-workspace-creation-form">
<hbox class="zen-workspace-creation-name-wrapper"> <hbox class="zen-workspace-creation-name-wrapper">
@ -45,8 +47,10 @@
<menupopup class="zen-workspace-creation-profiles-popup" /> <menupopup class="zen-workspace-creation-profiles-popup" />
</vbox> </vbox>
<vbox class="zen-workspace-creation-buttons"> <vbox class="zen-workspace-creation-buttons">
<html:div>
<button class="zen-workspace-creation-create-button footer-button primary" <button class="zen-workspace-creation-create-button footer-button primary"
data-l10n-id="zen-panel-ui-workspaces-create" disabled="true" /> data-l10n-id="zen-panel-ui-workspaces-create" disabled="true" />
</html:div>
<button class="zen-workspace-creation-cancel-button footer-button" <button class="zen-workspace-creation-cancel-button footer-button"
data-l10n-id="zen-general-cancel-label" /> data-l10n-id="zen-general-cancel-label" />
</vbox> </vbox>
@ -59,6 +63,22 @@
return this.getAttribute('workspace-id'); return this.getAttribute('workspace-id');
} }
get previousWorkspaceId() {
return this.getAttribute('previous-workspace-id');
}
get elementsToAnimate() {
return [
this.querySelector('.zen-workspace-creation-title'),
this.querySelector('.zen-workspace-creation-label').parentElement,
this.querySelector('.zen-workspace-creation-name-wrapper'),
this.querySelector('.zen-workspace-creation-profile-wrapper'),
this.querySelector('.zen-workspace-creation-edit-theme-button'),
this.createButton.parentNode,
this.cancelButton,
];
}
connectedCallback() { connectedCallback() {
if (this.delayConnectedCallback()) { if (this.delayConnectedCallback()) {
// If we are not ready yet, or if we have already connected, we // If we are not ready yet, or if we have already connected, we
@ -66,11 +86,19 @@
return; return;
} }
document.documentElement.setAttribute('zen-creating-workspace', 'true');
this.appendChild(this.constructor.fragment); this.appendChild(this.constructor.fragment);
this.initializeAttributeInheritance(); this.initializeAttributeInheritance();
this.inputName = this.querySelector('.zen-workspace-creation-name');
this.inputIcon = this.querySelector('.zen-workspace-creation-icon-label');
this.inputProfile = this.querySelector('.zen-workspace-creation-profile');
this.createButton = this.querySelector('.zen-workspace-creation-create-button');
this.cancelButton = this.querySelector('.zen-workspace-creation-cancel-button');
for (const element of this.elementsToAnimate) {
element.style.opacity = 0;
}
this.#wasInCollapsedMode = this.#wasInCollapsedMode =
document.documentElement.getAttribute('zen-sidebar-expanded') !== 'true'; document.documentElement.getAttribute('zen-sidebar-expanded') !== 'true';
@ -91,11 +119,6 @@
} }
} }
gBrowser.tabContainer.style.visibility = 'collapse';
if (gZenVerticalTabsManager._hasSetSingleToolbar) {
document.getElementById('nav-bar').style.visibility = 'collapse';
}
for (const element of ZenWorkspaceCreation.elementsToDisable) { for (const element of ZenWorkspaceCreation.elementsToDisable) {
const el = document.getElementById(element); const el = document.getElementById(element);
if (el) { if (el) {
@ -103,12 +126,6 @@
} }
} }
this.inputName = this.querySelector('.zen-workspace-creation-name');
this.inputIcon = this.querySelector('.zen-workspace-creation-icon-label');
this.inputProfile = this.querySelector('.zen-workspace-creation-profile');
this.createButton = this.querySelector('.zen-workspace-creation-create-button');
this.cancelButton = this.querySelector('.zen-workspace-creation-cancel-button');
this.createButton.addEventListener('command', this.onCreateButtonCommand.bind(this)); this.createButton.addEventListener('command', this.onCreateButtonCommand.bind(this));
this.cancelButton.addEventListener('command', this.onCancelButtonCommand.bind(this)); this.cancelButton.addEventListener('command', this.onCancelButtonCommand.bind(this));
@ -133,7 +150,47 @@
this.inputProfile.parentNode.hidden = true; this.inputProfile.parentNode.hidden = true;
} }
document.getElementById('zen-sidebar-splitter').style.pointerEvents = 'none';
gZenUIManager.motion
.animate(
[gBrowser.tabContainer, gURLBar.textbox],
{
opacity: [1, 0],
},
{
duration: 0.3,
type: 'spring',
bounce: 0,
}
)
.then(() => {
gBrowser.tabContainer.style.visibility = 'collapse';
if (gZenVerticalTabsManager._hasSetSingleToolbar) {
document.getElementById('nav-bar').style.visibility = 'collapse';
}
this.style.visibility = 'visible';
gZenUIManager.motion
.animate(
this.elementsToAnimate,
{
y: [20, 0],
opacity: [0, 1],
filter: ['blur(2px)', 'blur(0)'],
},
{
duration: 0.6,
type: 'spring',
bounce: 0,
delay: gZenUIManager.motion.stagger(0.05, { startDelay: 0.2 }),
}
)
.then(() => {
this.inputName.focus();
gZenWorkspaces.workspaceElement(this.workspaceId).hidden = false;
this.resolveInitialized(); this.resolveInitialized();
});
});
} }
async onCreateButtonCommand() { async onCreateButtonCommand() {
@ -143,21 +200,16 @@
workspace.containerTabId = this.currentProfile; workspace.containerTabId = this.currentProfile;
await gZenWorkspaces.saveWorkspace(workspace); await gZenWorkspaces.saveWorkspace(workspace);
this.#cleanup(); await this.#cleanup();
await gZenWorkspaces._organizeWorkspaceStripLocations(workspace, true); await gZenWorkspaces._organizeWorkspaceStripLocations(workspace, true);
await gZenWorkspaces.updateTabsContainers(); await gZenWorkspaces.updateTabsContainers();
this.tabContainer._invalidateCachedTabs(); gBrowser.tabContainer._invalidateCachedTabs();
if (gZenVerticalTabsManager._canReplaceNewTab) {
BrowserCommands.openTab();
}
} }
async onCancelButtonCommand() { async onCancelButtonCommand() {
const workspaces = await gZenWorkspaces._workspaces(); await gZenWorkspaces.changeWorkspaceWithID(this.previousWorkspaceId);
await gZenWorkspaces.changeWorkspace(workspaces.workspaces[workspaces.workspaces.length - 2]);
} }
onIconCommand(event) { onIconCommand(event) {
@ -208,10 +260,27 @@
async handleZenWorkspacesChange() { async handleZenWorkspacesChange() {
await gZenWorkspaces.removeWorkspace(this.workspaceId); await gZenWorkspaces.removeWorkspace(this.workspaceId);
this.#cleanup(); await this.#cleanup();
} }
#cleanup() { async #cleanup() {
await gZenUIManager.motion.animate(
this.elementsToAnimate.reverse(),
{
y: [0, 20],
opacity: [1, 0],
filter: ['blur(0)', 'blur(2px)'],
},
{
duration: 0.4,
type: 'spring',
bounce: 0,
delay: gZenUIManager.motion.stagger(0.05),
}
);
document.getElementById('zen-sidebar-splitter').style.pointerEvents = '';
gZenWorkspaces.removeChangeListeners(this.handleZenWorkspacesChangeBind); gZenWorkspaces.removeChangeListeners(this.handleZenWorkspacesChangeBind);
for (const element of this.constructor.elementsToDisable) { for (const element of this.constructor.elementsToDisable) {
const el = document.getElementById(element); const el = document.getElementById(element);
@ -228,8 +297,32 @@
document.documentElement.removeAttribute('zen-creating-workspace'); document.documentElement.removeAttribute('zen-creating-workspace');
gBrowser.tabContainer.style.visibility = ''; gBrowser.tabContainer.style.visibility = '';
gBrowser.tabContainer.style.opacity = 0;
if (gZenVerticalTabsManager._hasSetSingleToolbar) { if (gZenVerticalTabsManager._hasSetSingleToolbar) {
document.getElementById('nav-bar').style.visibility = ''; document.getElementById('nav-bar').style.visibility = '';
gURLBar.textbox.style.opacity = 0;
}
gZenUIManager.updateTabsToolbar();
const workspace = await gZenWorkspaces.getActiveWorkspace();
await gZenWorkspaces._organizeWorkspaceStripLocations(workspace, true);
await gZenWorkspaces.updateTabsContainers();
await gZenUIManager.motion.animate(
[gBrowser.tabContainer, gURLBar.textbox],
{
opacity: [0, 1],
},
{
duration: 0.3,
type: 'spring',
bounce: 0,
}
);
gBrowser.tabContainer.style.opacity = '';
if (gZenVerticalTabsManager._hasSetSingleToolbar) {
gURLBar.textbox.style.opacity = '';
} }
for (const element of this.#hiddenElements) { for (const element of this.#hiddenElements) {

View file

@ -14,6 +14,74 @@
this._hasConnected = true; this._hasConnected = true;
window.addEventListener('ZenWorkspacesUIUpdate', this, true); window.addEventListener('ZenWorkspacesUIUpdate', this, true);
this.initDragAndDrop();
}
initDragAndDrop() {
let dragStart = 0;
let draggedTab = null;
this.addEventListener('mousedown', (e) => {
const target = e.target.closest('toolbarbutton[zen-workspace-id]');
if (!target) {
return;
}
const isVertical = document.documentElement.getAttribute('zen-sidebar-expanded') != 'true';
const clientPos = isVertical ? 'clientY' : 'clientX';
this.isReorderMode = false;
dragStart = e[clientPos];
draggedTab = target;
draggedTab.setAttribute('dragged', 'true');
e.stopPropagation();
const mouseMoveHandler = (moveEvent) => {
if (Math.abs(moveEvent[clientPos] - dragStart) > 5) {
this.isReorderMode = true;
}
if (this.isReorderMode) {
const tabs = [...this.children];
const mouse = moveEvent[clientPos];
for (const tab of tabs) {
if (tab === draggedTab) continue;
const rect = tab.getBoundingClientRect();
if (
mouse > rect[isVertical ? 'top' : 'left'] &&
mouse < rect[isVertical ? 'bottom' : 'right']
) {
if (
mouse <
rect[isVertical ? 'top' : 'left'] + rect[isVertical ? 'height' : 'width'] / 2
) {
this.insertBefore(draggedTab, tab);
} else {
this.insertBefore(draggedTab, tab.nextSibling);
}
}
}
}
};
const mouseUpHandler = () => {
document.removeEventListener('mousemove', mouseMoveHandler);
document.removeEventListener('mouseup', mouseUpHandler);
draggedTab.removeAttribute('dragged');
this.reorderWorkspaceToIndex(draggedTab, Array.from(this.children).indexOf(draggedTab));
draggedTab = null;
this.isReorderMode = false;
};
document.addEventListener('mousemove', mouseMoveHandler);
document.addEventListener('mouseup', mouseUpHandler);
});
} }
#createWorkspaceIcon(workspace) { #createWorkspaceIcon(workspace) {
@ -91,6 +159,25 @@
} }
return null; return null;
} }
get isReorderMode() {
return this.hasAttribute('reorder-mode');
}
set isReorderMode(value) {
if (value) {
this.setAttribute('reorder-mode', 'true');
} else {
this.removeAttribute('reorder-mode');
this.style.removeProperty('--zen-workspace-icon-width');
this.style.removeProperty('--zen-workspace-icon-height');
}
}
reorderWorkspaceToIndex(draggedTab, index) {
const workspaceId = draggedTab.getAttribute('zen-workspace-id');
gZenWorkspaces.reorderWorkspace(workspaceId, index);
}
} }
customElements.define('zen-workspace-icons', ZenWorkspaceIcons); customElements.define('zen-workspace-icons', ZenWorkspaceIcons);

View file

@ -385,18 +385,21 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
} }
async initializeTabsStripSections() { async initializeTabsStripSections() {
await SessionStore.promiseInitialized;
await SessionStore.promiseAllWindowsRestored; await SessionStore.promiseAllWindowsRestored;
const perifery = document.getElementById('tabbrowser-arrowscrollbox-periphery'); const perifery = document.getElementById('tabbrowser-arrowscrollbox-periphery');
perifery.setAttribute('hidden', 'true'); perifery.setAttribute('hidden', 'true');
await new Promise((resolve) => {
setTimeout(async () => {
const tabs = gBrowser.tabContainer.allTabs; const tabs = gBrowser.tabContainer.allTabs;
const workspaces = await this._workspaces(); const workspaces = await this._workspaces();
for (const workspace of workspaces.workspaces) { for (const workspace of workspaces.workspaces) {
await this._createWorkspaceTabsSection(workspace, tabs); await this._createWorkspaceTabsSection(workspace, tabs);
} }
if (tabs.length) { if (tabs.length) {
const defaultSelectedContainer = this.workspaceElement(this.activeWorkspace).querySelector( const defaultSelectedContainer = this.workspaceElement(
'.zen-workspace-normal-tabs-section' this.activeWorkspace
); ).querySelector('.zen-workspace-normal-tabs-section');
const pinnedContainer = this.workspaceElement(this.activeWorkspace).querySelector( const pinnedContainer = this.workspaceElement(this.activeWorkspace).querySelector(
'.zen-workspace-pinned-tabs-section' '.zen-workspace-pinned-tabs-section'
); );
@ -421,6 +424,9 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
this.registerPinnedResizeObserver(); this.registerPinnedResizeObserver();
this._fixIndicatorsNames(workspaces); this._fixIndicatorsNames(workspaces);
this._resolveSectionsInitialized(); this._resolveSectionsInitialized();
resolve();
}, 0);
});
} }
getEssentialsSection(container = 0) { getEssentialsSection(container = 0) {
@ -466,6 +472,10 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
workspaceWrapper.active = true; workspaceWrapper.active = true;
} }
if (document.documentElement.hasAttribute('zen-creating-workspace')) {
workspaceWrapper.hidden = true; // Hide workspace while creating it
}
await new Promise((resolve) => { await new Promise((resolve) => {
workspaceWrapper.addEventListener( workspaceWrapper.addEventListener(
'ZenWorkspaceAttached', 'ZenWorkspaceAttached',
@ -647,7 +657,7 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
_handleSwipeMayStart(event) { _handleSwipeMayStart(event) {
if (this.privateWindowOrDisabled || this._inChangingWorkspace) return; if (this.privateWindowOrDisabled || this._inChangingWorkspace) return;
if (event.target.closest('#zen-sidebar-bottom-buttons')) return; if (event.target.closest('#zen-sidebar-foot-buttons')) return;
// Only handle horizontal swipes // Only handle horizontal swipes
if (event.direction === event.DIRECTION_LEFT || event.direction === event.DIRECTION_RIGHT) { if (event.direction === event.DIRECTION_LEFT || event.direction === event.DIRECTION_RIGHT) {
@ -863,9 +873,9 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
} }
this.onWindowResize(); this.onWindowResize();
await gZenSessionStore.promiseInitialized; await gZenSessionStore.promiseInitialized;
await this.workspaceBookmarks();
await this.initializeTabsStripSections(); await this.initializeTabsStripSections();
this._initializeEmptyTab(); this._initializeEmptyTab();
await this.workspaceBookmarks();
await gZenPinnedTabManager.refreshPinnedTabs({ init: true }); await gZenPinnedTabManager.refreshPinnedTabs({ init: true });
await this.changeWorkspace(activeWorkspace, { onInit: true }); await this.changeWorkspace(activeWorkspace, { onInit: true });
this._fixTabPositions(); this._fixTabPositions();
@ -1099,11 +1109,6 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
} }
addPopupListeners() { addPopupListeners() {
const popup = document.getElementById('PanelUI-zen-workspaces');
popup.addEventListener('popuphidden', this.handlePanelHidden.bind(this));
popup.addEventListener('command', this.handlePanelCommand.bind(this));
const workspaceActions = document.getElementById('zenWorkspaceMoreActions'); const workspaceActions = document.getElementById('zenWorkspaceMoreActions');
workspaceActions.addEventListener('popupshowing', this.updateWorkspaceActionsMenu.bind(this)); workspaceActions.addEventListener('popupshowing', this.updateWorkspaceActionsMenu.bind(this));
@ -1134,19 +1139,6 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
} }
} }
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;
}
}
updateWorkspaceActionsMenuContainer(event) { updateWorkspaceActionsMenuContainer(event) {
const workspace = this.getActiveWorkspaceFromCache(); const workspace = this.getActiveWorkspaceFromCache();
let containerTabId = workspace.containerTabId; let containerTabId = workspace.containerTabId;
@ -1225,208 +1217,6 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
} }
async _propagateWorkspaceDataForWindow(browser, { ignoreStrip = false, clearCache = true } = {}) { async _propagateWorkspaceDataForWindow(browser, { ignoreStrip = false, clearCache = true } = {}) {
let workspaceList = browser.document.getElementById('PanelUI-zen-workspaces-list');
const createWorkspaceElement = (workspace) => {
let element = browser.document.createXULElement('toolbarbutton');
element.className = 'subviewbutton zen-workspace-button';
element.setAttribute('tooltiptext', workspace.name);
element.setAttribute('zen-workspace-id', workspace.uuid);
if (this.isWorkspaceActive(workspace)) {
element.setAttribute('active', 'true');
}
let containerGroup = undefined;
try {
containerGroup = browser.ContextualIdentityService.getPublicIdentities().find(
(container) => container.userContextId === workspace.containerTabId
);
} catch (e) {
console.warn('gZenWorkspaces: Error setting container color', e);
}
if (containerGroup) {
element.classList.add('identity-color-' + containerGroup.color);
element.setAttribute('data-usercontextid', containerGroup.userContextId);
}
// Set draggable attribute based on reorder mode
if (this.isReorderModeOn(browser)) {
element.setAttribute('draggable', 'true');
}
element.addEventListener(
'dragstart',
function (event) {
if (this.isReorderModeOn(browser)) {
this.draggedElement = element;
event.dataTransfer.effectAllowed = 'move';
event.dataTransfer.setData('text/plain', element.getAttribute('zen-workspace-id'));
// Create a transparent drag image for Linux
if (AppConstants.platform === 'linux') {
const dragImage = document.createElement('canvas');
dragImage.width = 1;
dragImage.height = 1;
event.dataTransfer.setDragImage(dragImage, 0, 0);
}
element.classList.add('dragging');
} else {
event.preventDefault();
}
}.bind(browser.gZenWorkspaces)
);
element.addEventListener(
'dragover',
function (event) {
if (this.isReorderModeOn(browser) && this.draggedElement) {
event.preventDefault();
event.dataTransfer.dropEffect = 'move';
// Ensure the dragover effect is visible on Linux
if (AppConstants.platform === 'linux') {
const targetId = element.getAttribute('zen-workspace-id');
const draggedId = this.draggedElement.getAttribute('zen-workspace-id');
if (targetId !== draggedId) {
element.classList.add('dragover');
}
}
}
}.bind(browser.gZenWorkspaces)
);
element.addEventListener('dragenter', function (event) {
if (this.isReorderModeOn(browser) && this.draggedElement) {
element.classList.add('dragover');
}
});
element.addEventListener('dragleave', function (event) {
element.classList.remove('dragover');
});
element.addEventListener(
'drop',
async function (event) {
event.preventDefault();
element.classList.remove('dragover');
if (this.isReorderModeOn(browser)) {
const draggedWorkspaceId = event.dataTransfer.getData('text/plain');
const targetWorkspaceId = element.getAttribute('zen-workspace-id');
if (draggedWorkspaceId !== targetWorkspaceId) {
await this.moveWorkspace(draggedWorkspaceId, targetWorkspaceId);
}
if (this.draggedElement) {
this.draggedElement.classList.remove('dragging');
this.draggedElement = null;
}
}
}.bind(browser.gZenWorkspaces)
);
element.addEventListener(
'dragend',
function (event) {
if (this.draggedElement) {
this.draggedElement.classList.remove('dragging');
this.draggedElement = null;
}
const workspaceElements = browser.document.querySelectorAll('.zen-workspace-button');
for (const elem of workspaceElements) {
elem.classList.remove('dragover');
}
}.bind(browser.gZenWorkspaces)
);
let childs = browser.MozXULElement.parseXULToFragment(`
<div class="zen-workspace-icon">
</div>
<vbox>
<div class="zen-workspace-name">
</div>
<div class="zen-workspace-container" ${containerGroup ? '' : 'hidden="true"'}>
</div>
</vbox>
<image class="toolbarbutton-icon zen-workspace-actions-reorder-icon" ></image>
`);
// use text content instead of innerHTML to avoid XSS
childs.querySelector('.zen-workspace-icon').textContent =
browser.gZenWorkspaces.getWorkspaceIcon(workspace);
childs.querySelector('.zen-workspace-name').textContent = workspace.name;
if (containerGroup) {
childs.querySelector('.zen-workspace-container').textContent =
ContextualIdentityService.getUserContextLabel(containerGroup.userContextId);
}
element.appendChild(childs);
element.onclick = (async () => {
if (this.isReorderModeOn(browser)) {
return; // Return early if reorder mode is on
}
const workspaceId = element.getAttribute('zen-workspace-id');
const workspaces = await this._workspaces();
const workspace = workspaces.workspaces.find((w) => w.uuid === workspaceId);
await this.changeWorkspace(workspace);
let panel = this.ownerWindow.document.getElementById('PanelUI-zen-workspaces');
PanelMultiView.hidePopup(panel);
}).bind(browser.gZenWorkspaces);
return element;
};
const createLastPositionDropTarget = () => {
const element = browser.document.createXULElement('div');
element.className = 'zen-workspace-last-place-drop-target';
element.addEventListener(
'dragover',
function (event) {
if (this.isReorderModeOn(browser) && this.draggedElement) {
event.preventDefault();
event.dataTransfer.dropEffect = 'move';
// Ensure the dragover effect is visible on Linux
if (AppConstants.platform === 'linux') {
element.classList.add('dragover');
}
}
}.bind(browser.gZenWorkspaces)
);
element.addEventListener(
'dragenter',
function (event) {
if (this.isReorderModeOn(browser) && this.draggedElement) {
element.classList.add('dragover');
}
}.bind(browser.gZenWorkspaces)
);
element.addEventListener(
'dragleave',
function (event) {
element.classList.remove('dragover');
}.bind(browser.gZenWorkspaces)
);
element.addEventListener(
'drop',
async function (event) {
event.preventDefault();
element.classList.remove('dragover');
if (this.isReorderModeOn(browser)) {
const draggedWorkspaceId = event.dataTransfer.getData('text/plain');
await this.moveWorkspaceToEnd(draggedWorkspaceId);
if (this.draggedElement) {
this.draggedElement.classList.remove('dragging');
this.draggedElement = null;
}
}
}.bind(browser.gZenWorkspaces)
);
return element;
};
if (clearCache) { if (clearCache) {
browser.gZenWorkspaces._workspaceCache = null; browser.gZenWorkspaces._workspaceCache = null;
browser.gZenWorkspaces._workspaceBookmarksCache = null; browser.gZenWorkspaces._workspaceBookmarksCache = null;
@ -1444,21 +1234,6 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
); );
} }
await browser.gZenWorkspaces.workspaceBookmarks(); await browser.gZenWorkspaces.workspaceBookmarks();
workspaceList.innerHTML = '';
workspaceList.parentNode.style.display = 'flex';
if (workspaces.workspaces.length <= 0) {
workspaceList.innerHTML = 'No workspaces available';
workspaceList.setAttribute('empty', 'true');
} else {
workspaceList.removeAttribute('empty');
}
for (let workspace of workspaces.workspaces) {
let workspaceElement = createWorkspaceElement(workspace);
workspaceList.appendChild(workspaceElement);
}
workspaceList.appendChild(createLastPositionDropTarget());
if (!ignoreStrip) { if (!ignoreStrip) {
browser.gZenWorkspaces._fixIndicatorsNames(workspaces); browser.gZenWorkspaces._fixIndicatorsNames(workspaces);
} }
@ -1489,57 +1264,35 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
}); });
} }
handlePanelHidden() { async reorderWorkspace(id, newPosition) {
const workspacesList = document.getElementById('PanelUI-zen-workspaces-list'); if (this.privateWindowOrDisabled) {
const reorderModeButton = document.getElementById('PanelUI-zen-workspaces-reorder-mode'); return;
workspacesList?.removeAttribute('reorder-mode');
reorderModeButton?.removeAttribute('active');
} }
async moveWorkspaceToEnd(draggedWorkspaceId) {
const workspaces = (await this._workspaces()).workspaces; const workspaces = (await this._workspaces()).workspaces;
const draggedIndex = workspaces.findIndex((w) => w.uuid === draggedWorkspaceId); const workspace = workspaces.find((w) => w.uuid === id);
const draggedWorkspace = workspaces.splice(draggedIndex, 1)[0]; if (!workspace) {
workspaces.push(draggedWorkspace); console.warn(`Workspace with ID ${id} not found for reordering.`);
return;
}
// Remove the workspace from its current position
const currentIndex = workspaces.indexOf(workspace);
if (currentIndex === -1) {
console.warn(`Workspace with ID ${id} not found in the list.`);
return;
}
workspaces.splice(currentIndex, 1);
// Insert the workspace at the new position
if (newPosition < 0 || newPosition > workspaces.length) {
console.warn(`Invalid position ${newPosition} for reordering workspace with ID ${id}.`);
return;
}
workspaces.splice(newPosition, 0, workspace);
// Update the positions in the storage
await ZenWorkspacesStorage.updateWorkspacePositions(workspaces); await ZenWorkspacesStorage.updateWorkspacePositions(workspaces);
// Propagate the changes
await this._propagateWorkspaceData(); await this._propagateWorkspaceData();
} }
isReorderModeOn(browser) {
return (
browser.document
.getElementById('PanelUI-zen-workspaces-list')
.getAttribute('reorder-mode') === 'true'
);
}
toggleReorderMode() {
const workspacesList = document.getElementById('PanelUI-zen-workspaces-list');
const reorderModeButton = document.getElementById('PanelUI-zen-workspaces-reorder-mode');
const isActive = workspacesList.getAttribute('reorder-mode') === 'true';
if (isActive) {
workspacesList.removeAttribute('reorder-mode');
reorderModeButton.removeAttribute('active');
} else {
workspacesList.setAttribute('reorder-mode', 'true');
reorderModeButton.setAttribute('active', 'true');
}
// Update draggable attribute
const workspaceElements = document.querySelectorAll('.zen-workspace-button');
workspaceElements.forEach((elem) => {
// When reorder mode is toggled off, remove draggable attribute
// When reorder mode is toggled on, set draggable attribute
if (isActive) {
elem.removeAttribute('draggable');
} else {
elem.setAttribute('draggable', 'true');
}
});
}
async moveWorkspace(draggedWorkspaceId, targetWorkspaceId) { async moveWorkspace(draggedWorkspaceId, targetWorkspaceId) {
const workspaces = (await this._workspaces()).workspaces; const workspaces = (await this._workspaces()).workspaces;
const draggedIndex = workspaces.findIndex((w) => w.uuid === draggedWorkspaceId); const draggedIndex = workspaces.findIndex((w) => w.uuid === draggedWorkspaceId);
@ -1551,28 +1304,15 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
await this._propagateWorkspaceData(); await this._propagateWorkspaceData();
} }
async openWorkspacesDialog(event) { async openWorkspaceCreation() {
if (!this.workspaceEnabled || this.isPrivateWindow) {
return;
}
let target = this.activeWorkspaceIndicator || event.target;
let panel = document.getElementById('PanelUI-zen-workspaces');
await this._propagateWorkspaceData({
ignoreStrip: true,
clearCache: false,
});
PanelMultiView.openPopup(panel, target, {
position: 'bottomright topright',
triggerEvent: event,
}).catch(console.error);
}
async openWorkspaceCreation(event) {
let createForm; let createForm;
const previousWorkspace = await this.getActiveWorkspace();
document.documentElement.setAttribute('zen-creating-workspace', 'true');
await this.createAndSaveWorkspace('Space', undefined, false, 0, { await this.createAndSaveWorkspace('Space', undefined, false, 0, {
beforeChangeCallback: async (workspace) => { beforeChangeCallback: async (workspace) => {
createForm = document.createXULElement('zen-workspace-creation'); createForm = document.createXULElement('zen-workspace-creation');
createForm.setAttribute('workspace-id', workspace.uuid); createForm.setAttribute('workspace-id', workspace.uuid);
createForm.setAttribute('previous-workspace-id', previousWorkspace?.uuid || '');
gBrowser.tabContainer.after(createForm); gBrowser.tabContainer.after(createForm);
await createForm.promiseInitialized; await createForm.promiseInitialized;
}, },
@ -1580,11 +1320,6 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
createForm.finishSetup(); createForm.finishSetup();
} }
closeWorkspacesSubView() {
let parentPanel = document.getElementById('PanelUI-zen-workspaces-multiview');
parentPanel.goBack(parentPanel);
}
// Workspaces management // Workspaces management
_deleteAllTabsInWorkspace(workspaceID) { _deleteAllTabsInWorkspace(workspaceID) {
@ -1794,6 +1529,10 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
} }
async _organizeWorkspaceStripLocations(workspace, justMove = false, offsetPixels = 0) { async _organizeWorkspaceStripLocations(workspace, justMove = false, offsetPixels = 0) {
if (document.documentElement.hasAttribute('zen-creating-workspace')) {
// If we are creating a workspace, we don't want to animate the strip
return;
}
this._organizingWorkspaceStrip = true; this._organizingWorkspaceStrip = true;
const workspaces = await this._workspaces(); const workspaces = await this._workspaces();
let workspaceIndex = workspaces.workspaces.findIndex((w) => w.uuid === workspace.uuid); let workspaceIndex = workspaces.workspaces.findIndex((w) => w.uuid === workspace.uuid);
@ -2454,7 +2193,11 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
} }
async onPinnedTabsResize(entries, forAnimation = false, animateContainer = false) { async onPinnedTabsResize(entries, forAnimation = false, animateContainer = false) {
if (!this._hasInitializedTabsStrip || (this._organizingWorkspaceStrip && !forAnimation)) { if (
!this._hasInitializedTabsStrip ||
(this._organizingWorkspaceStrip && !forAnimation) ||
document.documentElement.hasAttribute('zen-creating-workspace')
) {
return; return;
} }
if (document.documentElement.hasAttribute('customizing')) return; if (document.documentElement.hasAttribute('customizing')) return;
@ -2631,6 +2374,7 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
_initializeWorkspaceTabContextMenus() { _initializeWorkspaceTabContextMenus() {
if (this.privateWindowOrDisabled) { if (this.privateWindowOrDisabled) {
document.getElementById('cmd_zenOpenWorkspaceCreation').setAttribute('disabled', true);
return; return;
} }
const menu = document.createXULElement('menu'); const menu = document.createXULElement('menu');
@ -2643,10 +2387,6 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
menu.appendChild(menuPopup); menu.appendChild(menuPopup);
document.getElementById('context_closeDuplicateTabs').after(menu); document.getElementById('context_closeDuplicateTabs').after(menu);
document
.getElementById('cmd_zenOpenWorkspaceCreation')
.setAttribute('disabled', this.privateWindowOrDisabled);
} }
async changeTabWorkspace(workspaceID) { async changeTabWorkspace(workspaceID) {

View file

@ -6,29 +6,35 @@
zen-workspace-creation { zen-workspace-creation {
flex: 1; flex: 1;
max-width: calc(var(--zen-sidebar-width) - var(--zen-toolbox-padding) * 2); max-width: calc(var(--zen-sidebar-width) - var(--zen-toolbox-padding));
padding: 3px;
visibility: collapse;
& .zen-workspace-creation { & .zen-workspace-creation {
justify-content: center; justify-content: center;
& .zen-workspace-creation-title { & .zen-workspace-creation-title {
font-size: large; font-size: large;
margin-bottom: 5px;
text-align: center;
} }
& .zen-workspace-creation-label { & .zen-workspace-creation-label {
margin: 0; margin: 0;
opacity: 0.6; opacity: 0.4;
text-align: center;
} }
& form { & form {
--input-border-color: light-dark(rgba(255, 255, 255, 0.2), rgba(0, 0, 0, 0.2)); --input-bgcolor: light-dark(rgba(0, 0, 0, 0.05), rgba(255, 255, 255, 0.05));
--input-bgcolor: light-dark(rgba(0, 0, 0, 0.15), rgba(255, 255, 255, 0.15));
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: calc(100% - 10px); width: calc(100% - 10px);
margin: auto; margin: auto;
gap: 1rem; gap: 3.2rem;
margin-top: 1.2rem;
height: 100%;
& .zen-workspace-creation-form { & .zen-workspace-creation-form {
gap: 0.6rem; gap: 0.6rem;
@ -37,11 +43,12 @@ zen-workspace-creation {
& xul|button { & xul|button {
border: none; border: none;
margin: 0; margin: 0;
font-weight: 400 !important;
} }
& .zen-workspace-creation-name-wrapper { & .zen-workspace-creation-name-wrapper {
padding: 9px 6px; padding: 9px 6px;
border-radius: var(--zen-button-border-radius); border-radius: 8px !important;
margin: 0; margin: 0;
background-color: var(--input-bgcolor); background-color: var(--input-bgcolor);
gap: 8px; gap: 8px;
@ -93,7 +100,7 @@ zen-workspace-creation {
& .zen-workspace-creation-profile-wrapper { & .zen-workspace-creation-profile-wrapper {
padding: 4px; padding: 4px;
border-radius: var(--zen-button-border-radius); border-radius: 8px !important;
margin: 0; margin: 0;
background-color: var(--input-bgcolor); background-color: var(--input-bgcolor);
gap: 4px; gap: 4px;
@ -117,22 +124,27 @@ zen-workspace-creation {
} }
& .zen-workspace-creation-edit-theme-button { & .zen-workspace-creation-edit-theme-button {
border-radius: var(--zen-button-border-radius); border-radius: 8px !important;
margin: 0; margin: 0;
background-color: var(--input-bgcolor); background-color: var(--input-bgcolor);
justify-content: center; justify-content: center;
align-items: center; align-items: center;
appearance: none; appearance: none;
padding: 10px !important; padding: 10px !important;
&:hover {
background-color: light-dark(rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0.1));
}
} }
& .zen-workspace-creation-buttons { & .zen-workspace-creation-buttons {
gap: 0.5rem; gap: 0.5rem;
margin-top: 2rem; margin-top: auto;
& .zen-workspace-creation-create-button { & .zen-workspace-creation-create-button {
color: var(--button-text-color-primary) !important; color: var(--button-text-color-primary) !important;
background: var(--color-accent-primary) !important; background: var(--color-accent-primary) !important;
width: 100%;
} }
} }
} }

View file

@ -16,6 +16,7 @@
appearance: auto; appearance: auto;
position: relative; position: relative;
-moz-window-dragging: no-drag;
&[dont-show='true'] { &[dont-show='true'] {
display: none !important; display: none !important;
@ -55,14 +56,26 @@
width 0.1s; width 0.1s;
&[active='true'], &[active='true'],
&:hover { &:hover,
&[dragged='true'] {
filter: grayscale(0); filter: grayscale(0);
opacity: 1; opacity: 1;
} }
&:hover { &:hover,
&[dragged='true']{
background-color: var(--zen-toolbar-element-bg); background-color: var(--zen-toolbar-element-bg);
} }
&[dragged='true'] {
outline: 1px solid var(--zen-colors-primary);
outline-offset: -1px;
}
}
&[reorder-mode='true'] toolbarbutton:not([dragged='true']) {
opacity: 0.2 !important;
filter: grayscale(1) !important;
} }
&[icons-overflow] { &[icons-overflow] {
@ -78,7 +91,7 @@
%include overflow-icons.inc.css %include overflow-icons.inc.css
} }
&:has(toolbarbutton:hover) toolbarbutton[active='true'] { &:has(toolbarbutton:hover) toolbarbutton[active='true']:not([dragged='true']) {
%include overflow-icons.inc.css %include overflow-icons.inc.css
} }
} }
@ -122,222 +135,6 @@
} }
} }
/* Workspaces Panel UI */
#PanelUI-zen-workspaces {
--panel-width: 320px;
--panel-padding: 0;
}
#PanelUI-zen-workspaces > panelmultiview {
align-items: flex-start;
overflow-x: hidden;
overflow-y: auto;
}
#PanelUI-zen-workspaces panelmultiview panelview {
position: relative;
padding: 10px;
width: var(--panel-width);
}
#PanelUI-zen-workspaces-list {
display: flex;
flex-direction: column;
flex-shrink: 0;
}
#PanelUI-zen-workspaces-list[empty='true'] {
font-weight: 600;
padding: 10px;
width: 100%;
text-align: start;
opacity: 0.5;
}
.PanelUI-zen-workspaces-user-create {
height: 100%;
.PanelUI-zen-workspaces-creation-wraper {
border-radius: 5px;
border: 1px solid var(--zen-colors-border);
margin-top: 10px;
& .PanelUI-zen-workspaces-icons-container {
padding: 10px 0;
min-width: 40px;
display: flex;
align-items: center;
justify-content: center;
border-right: 1px solid var(--zen-colors-border);
margin-right: 2px;
}
& html|input {
border: none;
outline: none !important;
width: 100%;
}
}
}
#PanelUI-zen-workspaces-list toolbarbutton {
padding: 5px;
border-radius: var(--zen-button-border-radius);
margin-left: 0 !important;
margin-right: 0 !important;
display: flex;
align-items: center;
position: relative;
&:first-child {
margin-top: 10px;
}
& .zen-workspace-icon {
position: relative;
width: 30px;
height: 30px;
border-radius: var(--zen-button-border-radius);
margin-right: 10px;
border: 1px solid var(--zen-colors-border);
display: flex;
justify-content: center;
align-items: center;
font-weight: 600;
flex-shrink: 0;
}
&[data-usercontextid] .zen-workspace-icon {
border-color: color-mix(in srgb, var(--identity-tab-color) 40%, transparent 60%);
}
& > vbox:has(> .zen-workspace-name) {
overflow: hidden;
}
& .zen-workspace-name {
font-weight: 600;
display: inline-block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: 100%;
}
& .zen-workspace-container {
font-size: 12px;
opacity: 0.5;
font-weight: normal;
}
.zen-workspace-actions-reorder-icon {
display: none;
margin: 0;
margin-left: auto !important;
}
&.zen-workspace-button[active='true'] {
position: relative;
}
&.zen-workspace-button[active='true'] .zen-workspace-icon::before {
content: '';
position: absolute;
top: 50%;
transform: translateY(-50%);
left: -2px;
width: 2px;
height: 16px;
background-color: var(--toolbarbutton-icon-fill-attention);
border-radius: 5px;
}
}
.zen-workspace-button.dragging {
opacity: 0.5;
}
.zen-workspace-button.dragover::after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 2px;
background-color: var(--toolbarbutton-icon-fill-attention);
}
/* Enhanced visual feedback for Linux platform */
@supports (-moz-gtk-csd-available) {
.zen-workspace-button.dragover {
background-color: color-mix(in srgb, var(--toolbarbutton-icon-fill-attention) 15%, transparent);
}
.zen-workspace-button.dragover::after {
height: 3px;
}
}
.zen-workspace-last-place-drop-target.dragover {
background-color: var(--toolbarbutton-icon-fill-attention);
}
/* Enhanced visual feedback for Linux platform */
@supports (-moz-gtk-csd-available) {
.zen-workspace-last-place-drop-target {
height: 6px;
margin: 4px 0;
}
.zen-workspace-last-place-drop-target.dragover {
background-color: var(--toolbarbutton-icon-fill-attention);
box-shadow: 0 0 4px var(--toolbarbutton-icon-fill-attention);
}
}
#PanelUI-zen-workspaces-reorder-mode[active='true'] {
color: var(--toolbarbutton-icon-fill-attention) !important;
}
#PanelUI-zen-workspaces-list[reorder-mode='true'] toolbarbutton {
.zen-workspace-actions-reorder-icon {
display: flex;
}
}
#PanelUI-zen-workspaces-list[reorder-mode='true'] .zen-workspace-last-place-drop-target {
display: block;
}
.zen-workspace-last-place-drop-target {
display: none;
height: 4px;
width: 100%;
border-radius: 5px;
}
#PanelUI-zen-workspaces-view > vbox:nth-child(2) {
margin-top: 10px;
}
#PanelUI-zen-workspaces-new,
#PanelUI-zen-workspaces-reorder-mode,
#PanelUI-zen-gradient-generator-color-custom-add {
min-height: 1px !important;
padding: 3px;
border-radius: 4px;
width: 24px;
height: 24px;
}
#PanelUI-zen-workspaces-header {
margin-right: auto;
}
/* Mark workspaces indicator */ /* Mark workspaces indicator */
.zen-current-workspace-indicator { .zen-current-workspace-indicator {
padding: calc(2px + var(--tab-inline-padding) + var(--zen-toolbox-padding)); padding: calc(2px + var(--tab-inline-padding) + var(--zen-toolbox-padding));

View file

@ -19,7 +19,7 @@
"brandShortName": "Zen", "brandShortName": "Zen",
"brandFullName": "Zen Browser", "brandFullName": "Zen Browser",
"release": { "release": {
"displayVersion": "1.12.11b", "displayVersion": "1.13b",
"github": { "github": {
"repo": "zen-browser/desktop" "repo": "zen-browser/desktop"
}, },
@ -39,7 +39,7 @@
"brandShortName": "Twilight", "brandShortName": "Twilight",
"brandFullName": "Zen Twilight", "brandFullName": "Zen Twilight",
"release": { "release": {
"displayVersion": "1.13t", "displayVersion": "1.14t",
"github": { "github": {
"repo": "zen-browser/desktop" "repo": "zen-browser/desktop"
} }