mirror of
https://github.com/zen-browser/desktop.git
synced 2025-09-05 19:08:18 +00:00
Merge branch 'zen-browser:dev' into dev
This commit is contained in:
@@ -206,127 +206,143 @@ var gZenVerticalTabsManager = {
|
||||
return;
|
||||
}
|
||||
this._isUpdating = true;
|
||||
this._updateMaxWidth();
|
||||
const topButtons = document.getElementById('zen-sidebar-top-buttons');
|
||||
const isCompactMode = Services.prefs.getBoolPref('zen.view.compact');
|
||||
const isVerticalTabs = Services.prefs.getBoolPref('zen.tabs.vertical');
|
||||
const isSidebarExpanded = Services.prefs.getBoolPref('zen.view.sidebar-expanded') || !isVerticalTabs;
|
||||
const isRightSide = Services.prefs.getBoolPref('zen.tabs.vertical.right-side') && isVerticalTabs;
|
||||
const isSingleToolbar = (Services.prefs.getBoolPref('zen.view.use-single-toolbar') && (isVerticalTabs && isSidebarExpanded) )|| !isVerticalTabs;
|
||||
const titlebar = document.getElementById('titlebar');
|
||||
try {
|
||||
this._updateMaxWidth();
|
||||
const topButtons = document.getElementById('zen-sidebar-top-buttons');
|
||||
const isCompactMode = Services.prefs.getBoolPref('zen.view.compact');
|
||||
const isVerticalTabs = Services.prefs.getBoolPref('zen.tabs.vertical');
|
||||
const isSidebarExpanded = Services.prefs.getBoolPref('zen.view.sidebar-expanded') || !isVerticalTabs;
|
||||
const isRightSide = Services.prefs.getBoolPref('zen.tabs.vertical.right-side') && isVerticalTabs;
|
||||
const isSingleToolbar = (Services.prefs.getBoolPref('zen.view.use-single-toolbar') && (isVerticalTabs && isSidebarExpanded) )|| !isVerticalTabs;
|
||||
const titlebar = document.getElementById('titlebar');
|
||||
|
||||
gBrowser.tabContainer.setAttribute('orient', isVerticalTabs ? 'vertical' : 'vertical');
|
||||
gBrowser.tabContainer.arrowScrollbox.setAttribute('orient', isVerticalTabs ? 'vertical' : 'horizontal');
|
||||
gBrowser.tabContainer.setAttribute('orient', isVerticalTabs ? 'vertical' : 'vertical');
|
||||
gBrowser.tabContainer.arrowScrollbox.setAttribute('orient', isVerticalTabs ? 'vertical' : 'horizontal');
|
||||
|
||||
const buttonsTarget = document.getElementById('zen-sidebar-top-buttons-customization-target');
|
||||
if (isRightSide) {
|
||||
this.navigatorToolbox.setAttribute('zen-right-side', 'true');
|
||||
document.documentElement.setAttribute('zen-right-side', 'true');
|
||||
} else {
|
||||
this.navigatorToolbox.removeAttribute('zen-right-side');
|
||||
document.documentElement.removeAttribute('zen-right-side');
|
||||
}
|
||||
|
||||
if (isSidebarExpanded) {
|
||||
this.navigatorToolbox.setAttribute('zen-sidebar-expanded', 'true');
|
||||
} else {
|
||||
this.navigatorToolbox.removeAttribute('zen-sidebar-expanded');
|
||||
}
|
||||
|
||||
const appContentNavbarContaienr = document.getElementById('zen-appcontent-navbar-container');
|
||||
if ((!isRightSide && this.isWindowsStyledButtons) || (isRightSide && !this.isWindowsStyledButtons) || isCompactMode) {
|
||||
appContentNavbarContaienr.setAttribute('should-hide', 'true');
|
||||
} else {
|
||||
appContentNavbarContaienr.removeAttribute('should-hide');
|
||||
}
|
||||
|
||||
// Check if the sidebar is in hover mode
|
||||
if (
|
||||
!this.navigatorToolbox.hasAttribute('zen-right-side') &&
|
||||
!isCompactMode
|
||||
) {
|
||||
this.navigatorToolbox.prepend(topButtons);
|
||||
// browser.prepend(this.navigatorToolbox);
|
||||
} else {
|
||||
// customizationTarget.prepend(topButtons);
|
||||
// tabboxWrapper.prepend(this.navigatorToolbox);
|
||||
}
|
||||
|
||||
//if (!isVerticalTabs) {
|
||||
// document.getElementById("urlbar-container").after(document.getElementById('navigator-toolbox'));
|
||||
//}
|
||||
|
||||
let windowButtons = this.actualWindowButtons;
|
||||
let doNotChangeWindowButtons = !isCompactMode && isRightSide && this.isWindowsStyledButtons;
|
||||
const navBar = document.getElementById('nav-bar');
|
||||
|
||||
if (isSingleToolbar) {
|
||||
this._navbarParent = navBar.parentElement;
|
||||
let elements = document.querySelectorAll('#nav-bar-customization-target > :is([cui-areatype="toolbar"], .chromeclass-toolbar-additional):not(#urlbar-container)');
|
||||
elements = Array.from(elements);
|
||||
// Add separator if it doesn't exist
|
||||
if (!buttonsTarget.contains(this._topButtonsSeparatorElement)) {
|
||||
buttonsTarget.append(this._topButtonsSeparatorElement);
|
||||
const buttonsTarget = document.getElementById('zen-sidebar-top-buttons-customization-target');
|
||||
if (isRightSide) {
|
||||
this.navigatorToolbox.setAttribute('zen-right-side', 'true');
|
||||
document.documentElement.setAttribute('zen-right-side', 'true');
|
||||
} else {
|
||||
this.navigatorToolbox.removeAttribute('zen-right-side');
|
||||
document.documentElement.removeAttribute('zen-right-side');
|
||||
}
|
||||
for (const button of elements) {
|
||||
buttonsTarget.append(button);
|
||||
|
||||
if (isSidebarExpanded) {
|
||||
this.navigatorToolbox.setAttribute('zen-sidebar-expanded', 'true');
|
||||
document.documentElement.setAttribute('zen-sidebar-expanded', 'true');
|
||||
} else {
|
||||
this.navigatorToolbox.removeAttribute('zen-sidebar-expanded');
|
||||
document.documentElement.removeAttribute('zen-sidebar-expanded');
|
||||
}
|
||||
buttonsTarget.prepend(document.getElementById('unified-extensions-button'));
|
||||
buttonsTarget.prepend(document.getElementById('PanelUI-button'));
|
||||
if (this.isWindowsStyledButtons && !doNotChangeWindowButtons) {
|
||||
document.getElementById('zen-appcontent-navbar-container').append(windowButtons);
|
||||
|
||||
const appContentNavbarContaienr = document.getElementById('zen-appcontent-navbar-container');
|
||||
if ((!isRightSide && this.isWindowsStyledButtons) || (isRightSide && !this.isWindowsStyledButtons) || isCompactMode) {
|
||||
appContentNavbarContaienr.setAttribute('should-hide', 'true');
|
||||
} else {
|
||||
appContentNavbarContaienr.removeAttribute('should-hide');
|
||||
}
|
||||
|
||||
// Check if the sidebar is in hover mode
|
||||
if (
|
||||
!this.navigatorToolbox.hasAttribute('zen-right-side') &&
|
||||
!isCompactMode
|
||||
) {
|
||||
this.navigatorToolbox.prepend(topButtons);
|
||||
// browser.prepend(this.navigatorToolbox);
|
||||
} else {
|
||||
// customizationTarget.prepend(topButtons);
|
||||
// tabboxWrapper.prepend(this.navigatorToolbox);
|
||||
}
|
||||
|
||||
//if (!isVerticalTabs) {
|
||||
// document.getElementById("urlbar-container").after(document.getElementById('navigator-toolbox'));
|
||||
//}
|
||||
|
||||
let windowButtons = this.actualWindowButtons;
|
||||
let doNotChangeWindowButtons = !isCompactMode && isRightSide && this.isWindowsStyledButtons;
|
||||
const navBar = document.getElementById('nav-bar');
|
||||
|
||||
if (isSingleToolbar) {
|
||||
this._navbarParent = navBar.parentElement;
|
||||
let elements = document.querySelectorAll('#nav-bar-customization-target > :is([cui-areatype="toolbar"], .chromeclass-toolbar-additional):not(#urlbar-container)');
|
||||
elements = Array.from(elements);
|
||||
// Add separator if it doesn't exist
|
||||
if (!buttonsTarget.contains(this._topButtonsSeparatorElement)) {
|
||||
buttonsTarget.append(this._topButtonsSeparatorElement);
|
||||
}
|
||||
for (const button of elements) {
|
||||
buttonsTarget.append(button);
|
||||
}
|
||||
buttonsTarget.prepend(document.getElementById('unified-extensions-button'));
|
||||
buttonsTarget.prepend(document.getElementById('PanelUI-button'));
|
||||
if (this.isWindowsStyledButtons && !doNotChangeWindowButtons) {
|
||||
document.getElementById('zen-appcontent-navbar-container').append(windowButtons);
|
||||
}
|
||||
if (isCompactMode) {
|
||||
titlebar.prepend(navBar);
|
||||
titlebar.prepend(topButtons);
|
||||
} else {
|
||||
titlebar.before(topButtons);
|
||||
titlebar.before(navBar);
|
||||
}
|
||||
document.documentElement.setAttribute("zen-single-toolbar", true);
|
||||
this._hasSetSingleToolbar = true;
|
||||
} else if (this._hasSetSingleToolbar) {
|
||||
this._hasSetSingleToolbar = false;
|
||||
// Do the opposite
|
||||
this._navbarParent.prepend(navBar);
|
||||
const elements = document.querySelectorAll('#zen-sidebar-top-buttons-customization-target > :is([cui-areatype="toolbar"], .chromeclass-toolbar-additional)');
|
||||
for (const button of elements) {
|
||||
document.getElementById('nav-bar-customization-target').append(button);
|
||||
}
|
||||
document.documentElement.removeAttribute("zen-single-toolbar");
|
||||
navBar.appendChild(document.getElementById('PanelUI-button'));
|
||||
this._toolbarOriginalParent.prepend(navBar);
|
||||
CustomizableUI.zenInternalCU._rebuildRegisteredAreas();
|
||||
}
|
||||
|
||||
if (isCompactMode) {
|
||||
titlebar.prepend(navBar);
|
||||
titlebar.prepend(topButtons);
|
||||
} else {
|
||||
titlebar.before(topButtons);
|
||||
titlebar.before(navBar);
|
||||
}
|
||||
document.documentElement.setAttribute("zen-single-toolbar", true);
|
||||
this._hasSetSingleToolbar = true;
|
||||
} else if (this._hasSetSingleToolbar) {
|
||||
this._hasSetSingleToolbar = false;
|
||||
// Do the opposite
|
||||
this._navbarParent.prepend(navBar);
|
||||
const elements = document.querySelectorAll('#zen-sidebar-top-buttons-customization-target > :is([cui-areatype="toolbar"], .chromeclass-toolbar-additional)');
|
||||
for (const button of elements) {
|
||||
document.getElementById('nav-bar-customization-target').append(button);
|
||||
}
|
||||
document.documentElement.removeAttribute("zen-single-toolbar");
|
||||
navBar.appendChild(document.getElementById('PanelUI-button'));
|
||||
this._toolbarOriginalParent.prepend(navBar);
|
||||
CustomizableUI.zenInternalCU._rebuildRegisteredAreas();
|
||||
}
|
||||
|
||||
if (isCompactMode) {
|
||||
titlebar.prepend(topButtons);
|
||||
} else {
|
||||
titlebar.before(topButtons);
|
||||
}
|
||||
|
||||
if (doNotChangeWindowButtons) {
|
||||
document.getElementById("zen-sidebar-top-buttons-customization-target").appendChild(windowButtons);
|
||||
} else if (!isSingleToolbar && !isCompactMode) {
|
||||
if (this.isWindowsStyledButtons) {
|
||||
if (isRightSide) {
|
||||
document.getElementById('zen-appcontent-navbar-container').append(windowButtons);
|
||||
if (isSidebarExpanded) {
|
||||
titlebar.before(topButtons);
|
||||
} else {
|
||||
navBar.append(windowButtons);
|
||||
}
|
||||
} else {
|
||||
if (isRightSide) {
|
||||
document.getElementById('zen-appcontent-navbar-container').appendChild(windowButtons);
|
||||
} else {
|
||||
topButtons.prepend(windowButtons);
|
||||
titlebar.prepend(topButtons);
|
||||
}
|
||||
}
|
||||
} else if (!isSingleToolbar && isCompactMode) {
|
||||
navBar.appendChild(windowButtons);
|
||||
}
|
||||
|
||||
// Always move the splitter next to the sidebar
|
||||
this.navigatorToolbox.after(document.getElementById('zen-sidebar-splitter'));
|
||||
if (doNotChangeWindowButtons) {
|
||||
if (isRightSide && !isSidebarExpanded) {
|
||||
navBar.appendChild(windowButtons);
|
||||
} else {
|
||||
document.getElementById("zen-sidebar-top-buttons-customization-target").appendChild(windowButtons);
|
||||
}
|
||||
} else if (!isSingleToolbar && !isCompactMode) {
|
||||
if (this.isWindowsStyledButtons) {
|
||||
if (isRightSide) {
|
||||
document.getElementById('zen-appcontent-navbar-container').append(windowButtons);
|
||||
} else {
|
||||
navBar.append(windowButtons);
|
||||
}
|
||||
} else {
|
||||
if (isRightSide) {
|
||||
document.getElementById('zen-appcontent-navbar-container').appendChild(windowButtons);
|
||||
} else {
|
||||
topButtons.prepend(windowButtons);
|
||||
}
|
||||
}
|
||||
} else if (!isSingleToolbar && isCompactMode) {
|
||||
navBar.appendChild(windowButtons);
|
||||
}
|
||||
|
||||
gZenCompactModeManager.updateCompactModeContext(isSingleToolbar);
|
||||
|
||||
// Always move the splitter next to the sidebar
|
||||
this.navigatorToolbox.after(document.getElementById('zen-sidebar-splitter'));
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
this._isUpdating = false;
|
||||
},
|
||||
|
||||
|
@@ -298,7 +298,7 @@
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
opacity: 1;
|
||||
transform: translate(-50%, -50%);
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -135,6 +135,10 @@
|
||||
background: var(--zen-dialog-background);
|
||||
padding-left: var(--zen-toolbox-padding) !important;
|
||||
|
||||
& > * {
|
||||
position: relative !important;
|
||||
}
|
||||
|
||||
:root[zen-window-buttons-reversed='true'] & {
|
||||
padding-left: 0 !important;
|
||||
padding-right: var(--zen-toolbox-padding) !important;
|
||||
|
@@ -100,7 +100,8 @@
|
||||
height: unset !important;
|
||||
}
|
||||
|
||||
.zen-sidebar-web-panel-splitter {
|
||||
.zen-sidebar-web-panel-splitter,
|
||||
.zen-split-view-splitter[orient="vertical"] {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
@@ -130,6 +131,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
.zen-split-view-splitter[orient="vertical"]::before {
|
||||
transform: translate(-75%, -50%);
|
||||
}
|
||||
|
||||
.zen-sidebar-web-panel-splitter[side='right'] {
|
||||
left: 100%;
|
||||
}
|
||||
|
@@ -243,10 +243,6 @@
|
||||
#tabbrowser-tabs[zen-workspace-animation='next'] & {
|
||||
animation: zen-slide-in 0.2s ease-in-out;
|
||||
}
|
||||
|
||||
&[pinned] {
|
||||
animation-delay: .03s !important;
|
||||
}
|
||||
}
|
||||
|
||||
max-width: unset;
|
||||
@@ -531,12 +527,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* Mark: toolbox as collapsed */
|
||||
#navigator-toolbox:not([zen-sidebar-expanded='true']) {
|
||||
:root:not([zen-sidebar-expanded='true']) {
|
||||
--tab-min-width: 36px !important;
|
||||
/* Important: When changin this value, make sure expand on hover doesn't break! */
|
||||
--zen-toolbox-padding: calc(var(--zen-element-separation) / 2 + 1px);
|
||||
--zen-toolbox-max-width: calc(var(--tab-min-width) + var(--zen-toolbox-padding) * 2);
|
||||
}
|
||||
|
||||
#navigator-toolbox:not([zen-sidebar-expanded='true']) {
|
||||
max-width: var(--zen-toolbox-max-width) !important;
|
||||
min-width: var(--zen-toolbox-max-width) !important;
|
||||
& #zen-current-workspace-indicator-name,
|
||||
@@ -890,7 +887,6 @@
|
||||
|
||||
&[selected] .tab-background {
|
||||
box-shadow: 0 0 1px 1px light-dark(rgba(0, 0, 0, 0.07), rgba(0, 0, 0, 0.1));
|
||||
outline: 1px solid light-dark(rgba(0, 0, 0, 0.2), rgba(255, 255, 255, 0.4)) !important;
|
||||
}
|
||||
|
||||
&:not([selected]) .tab-background {
|
||||
@@ -916,3 +912,22 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Very special occasions */
|
||||
|
||||
/* Mark: Right side windows controls with collapsed sidebar */
|
||||
@media not (-moz-bool-pref: 'zen.view.compact') {
|
||||
:root[zen-right-side='true']:not([zen-sidebar-expanded='true']):not([zen-window-buttons-reversed='true']) {
|
||||
& #navigator-toolbox {
|
||||
padding-top: var(--zen-toolbar-height);
|
||||
}
|
||||
|
||||
& .titlebar-buttonbox-container {
|
||||
margin-right: calc(-1 * var(--zen-toolbox-max-width)) !important;
|
||||
}
|
||||
|
||||
& #zen-appcontent-wrapper {
|
||||
overflow-x: visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -126,7 +126,7 @@
|
||||
--zen-themed-toolbar-bg: light-dark(var(--zen-branding-bg), var(--zen-colors-tertiary));
|
||||
--zen-themed-toolbar-bg-transparent: light-dark(var(--zen-branding-bg), var(--zen-colors-tertiary));
|
||||
|
||||
@supports (-moz-osx-font-smoothing: auto) {
|
||||
@media (-moz-windows-mica) or (-moz-platform: macos) {
|
||||
--zen-themed-toolbar-bg-transparency: 0.05;
|
||||
--zen-themed-toolbar-bg-transparent: light-dark(rgba(255, 255, 255, var(--zen-themed-toolbar-bg-transparency)), rgba(0, 0, 0, var(--zen-themed-toolbar-bg-transparency)));
|
||||
}
|
||||
|
@@ -16,15 +16,10 @@
|
||||
|
||||
#urlbar[breakout-extend='true'] {
|
||||
z-index: 1000;
|
||||
max-width: 45%;
|
||||
min-width: 45%;
|
||||
min-width: 600px;
|
||||
top: 0 !important;
|
||||
--urlbar-container-height: 55px !important;
|
||||
--urlbar-margin-inline: 10px !important;
|
||||
position: absolute;
|
||||
|
||||
top: calc(var(--zen-toolbar-height) * 4);
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
|
||||
& #urlbar-background {
|
||||
background: var(--zen-branding-bg) !important;
|
||||
@@ -36,22 +31,36 @@
|
||||
margin-right: var(--urlbar-margin-inline);
|
||||
}
|
||||
|
||||
#urlbar-container:has(&) {
|
||||
border-radius: var(--toolbarbutton-border-radius);
|
||||
background: var(--toolbarbutton-hover-background);
|
||||
:root[zen-right-side='true'] & {
|
||||
right: 0;
|
||||
}
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
z-index: -1;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
pointer-events: none;
|
||||
@media not (-moz-bool-pref: 'zen.view.compact') {
|
||||
max-width: 45%;
|
||||
min-width: 45%;
|
||||
position: absolute;
|
||||
|
||||
top: calc(var(--zen-toolbar-height) * 4) !important;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
|
||||
#urlbar-container:has(&) {
|
||||
border-radius: var(--toolbarbutton-border-radius);
|
||||
background: var(--toolbarbutton-hover-background);
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
z-index: -1;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -63,6 +63,13 @@ var gZenCompactModeManager = {
|
||||
this.updateContextMenu();
|
||||
},
|
||||
|
||||
updateCompactModeContext(isSingleToolbar) {
|
||||
const IDs = ['zen-context-menu-compact-mode-hide-sidebar', 'zen-context-menu-compact-mode-hide-toolbar', 'zen-context-menu-compact-mode-hide-both'];
|
||||
for (let id of IDs) {
|
||||
document.getElementById(id).disabled = isSingleToolbar;
|
||||
}
|
||||
},
|
||||
|
||||
hideSidebar() {
|
||||
Services.prefs.setBoolPref('zen.view.compact.hide-tabbar', true);
|
||||
Services.prefs.setBoolPref('zen.view.compact.hide-toolbar', false);
|
||||
|
27
src/browser/components/urlbar/UrlbarInput-sys-mjs.patch
Normal file
27
src/browser/components/urlbar/UrlbarInput-sys-mjs.patch
Normal file
@@ -0,0 +1,27 @@
|
||||
diff --git a/browser/components/urlbar/UrlbarInput.sys.mjs b/browser/components/urlbar/UrlbarInput.sys.mjs
|
||||
index c504c9afc43785b5f003bb1f9f1dfbddef38d78b..845043f5a887d4f46b0064792fb0834724e94a07 100644
|
||||
--- a/browser/components/urlbar/UrlbarInput.sys.mjs
|
||||
+++ b/browser/components/urlbar/UrlbarInput.sys.mjs
|
||||
@@ -3901,6 +3901,9 @@ export class UrlbarInput {
|
||||
}
|
||||
|
||||
_on_click(event) {
|
||||
+ event.zenOriginalTarget = this.textbox;
|
||||
+ this._on_mousedown(event);
|
||||
+
|
||||
if (
|
||||
event.target == this.inputField ||
|
||||
event.target == this._inputContainer ||
|
||||
@@ -4012,8 +4015,11 @@ export class UrlbarInput {
|
||||
}
|
||||
|
||||
_on_mousedown(event) {
|
||||
- switch (event.currentTarget) {
|
||||
+ switch (event.zenOriginalTarget || event.currentTarget) {
|
||||
case this.textbox: {
|
||||
+ if (event.type != "click") {
|
||||
+ return true;
|
||||
+ }
|
||||
this._mousedownOnUrlbarDescendant = true;
|
||||
|
||||
if (
|
Reference in New Issue
Block a user