From 58f97c65e148b3486a1a70fe6741c07a777a5d39 Mon Sep 17 00:00:00 2001 From: "Mr. M" Date: Wed, 19 Nov 2025 14:47:41 +0100 Subject: [PATCH] feat: Add preference for sidebar dragging, b=no-bug, c=common, workspaces --- prefs/zen/view.yaml | 3 ++ .../urlbar/UrlbarResult-sys-mjs.patch | 15 +++++++ src/zen/common/ZenUIManager.mjs | 44 +++++++++---------- src/zen/workspaces/zen-workspaces.css | 6 ++- 4 files changed, 42 insertions(+), 26 deletions(-) create mode 100644 src/browser/components/urlbar/UrlbarResult-sys-mjs.patch diff --git a/prefs/zen/view.yaml b/prefs/zen/view.yaml index 334de94da..7f5939822 100644 --- a/prefs/zen/view.yaml +++ b/prefs/zen/view.yaml @@ -57,3 +57,6 @@ - name: zen.view.show-clear-tabs-button value: true + +- name: zen.view.draggable-sidebar + value: true diff --git a/src/browser/components/urlbar/UrlbarResult-sys-mjs.patch b/src/browser/components/urlbar/UrlbarResult-sys-mjs.patch new file mode 100644 index 000000000..8aa60156a --- /dev/null +++ b/src/browser/components/urlbar/UrlbarResult-sys-mjs.patch @@ -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; + } diff --git a/src/zen/common/ZenUIManager.mjs b/src/zen/common/ZenUIManager.mjs index 115a75c97..238501278 100644 --- a/src/zen/common/ZenUIManager.mjs +++ b/src/zen/common/ZenUIManager.mjs @@ -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) { diff --git a/src/zen/workspaces/zen-workspaces.css b/src/zen/workspaces/zen-workspaces.css index bc4c528b6..674a9cd44 100644 --- a/src/zen/workspaces/zen-workspaces.css +++ b/src/zen/workspaces/zen-workspaces.css @@ -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; + } } }