feat: Add preference for sidebar dragging, b=no-bug, c=common, workspaces

This commit is contained in:
Mr. M
2025-11-19 14:47:41 +01:00
parent 72dbe631ec
commit 58f97c65e1
4 changed files with 42 additions and 26 deletions

View File

@@ -57,3 +57,6 @@
- name: zen.view.show-clear-tabs-button
value: true
- name: zen.view.draggable-sidebar
value: true

View File

@@ -0,0 +1,15 @@
diff --git a/browser/components/urlbar/UrlbarResult.sys.mjs b/browser/components/urlbar/UrlbarResult.sys.mjs
index 0882c0a01d17184cadb56aa1236ca97adf7f866b..4a5842eda6280205b96f9aee9b6f3b49fac7077c 100644
--- a/browser/components/urlbar/UrlbarResult.sys.mjs
+++ b/browser/components/urlbar/UrlbarResult.sys.mjs
@@ -172,6 +172,10 @@ export class UrlbarResult {
return this.#heuristic;
}
+ set heuristic(value) {
+ this.#heuristic = value;
+ }
+
get hideRowLabel() {
return this.#hideRowLabel;
}

View File

@@ -444,29 +444,29 @@ var gZenUIManager = {
gURLBar._zenHandleUrlbarClose = null;
}
const isFocusedBefore = gURLBar.focused;
setTimeout(() => {
// We use this attribute on Tabbrowser::addTab
gURLBar.removeAttribute('zen-newtab');
}, 0);
// Safely restore tab visual state with proper validation
if (
this._lastTab &&
!this._lastTab.closing &&
this._lastTab.ownerGlobal &&
!this._lastTab.ownerGlobal.closed
) {
this._lastTab._visuallySelected = true;
this._lastTab = null;
}
// Safely restore tab visual state with proper validation
if (
this._lastTab &&
!this._lastTab.closing &&
this._lastTab.ownerGlobal &&
!this._lastTab.ownerGlobal.closed &&
!onSwitch
) {
this._lastTab._visuallySelected = true;
this._lastTab = null;
}
// Reset newtab buttons
for (const button of this.newtabButtons) {
button.removeAttribute('in-urlbar');
}
// Reset newtab buttons
for (const button of this.newtabButtons) {
button.removeAttribute('in-urlbar');
}
// Handle search data
if (!onElementPicked) {
// Handle search data
if (onSwitch) {
this.clearUrlbarData();
} else {
@@ -487,12 +487,8 @@ var gZenUIManager = {
}
gURLBar.handleRevert();
} else if (onElementPicked && onSwitch) {
this.clearUrlbarData();
}
if (gURLBar.focused) {
setTimeout(() => {
if (isFocusedBefore) {
setTimeout(() => {
window.dispatchEvent(
new CustomEvent('ZenURLBarClosed', { detail: { onSwitch, onElementPicked } })
@@ -513,8 +509,8 @@ var gZenUIManager = {
}
}
}, 0);
}, 0);
}
}
}, 0);
},
urlbarTrim(aURL) {

View File

@@ -330,8 +330,10 @@ zen-workspace {
}
}
&[active] .zen-workspace-empty-space {
-moz-window-dragging: drag;
@media -moz-pref('zen.view.draggable-sidebar') {
&[active] .zen-workspace-empty-space {
-moz-window-dragging: drag;
}
}
}