From 9ddd9c81e3e5efed7f6e1013810fe60459c0edcd Mon Sep 17 00:00:00 2001 From: Ernestas Date: Thu, 12 Jun 2025 18:40:12 +0300 Subject: [PATCH] feat: add preference to toggle URL bar autofocus on startup Add zen.startup.focus-urlbar preference to control whether the URL bar is automatically focused when switching tabs during startup. Defaults to true to maintain current behavior while allowing users to disable this feature if desired. --- src/browser/app/profile/features.inc | 1 + src/zen/workspaces/ZenWorkspaces.mjs | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/browser/app/profile/features.inc b/src/browser/app/profile/features.inc index 49d79fab76..18c73bd083 100644 --- a/src/browser/app/profile/features.inc +++ b/src/browser/app/profile/features.inc @@ -39,3 +39,4 @@ pref('zen.haptic-feedback.enabled', true); // Startup flags pref('zen.startup.smooth-scroll-in-tabs', true); +pref('zen.startup.focus-urlbar', true); diff --git a/src/zen/workspaces/ZenWorkspaces.mjs b/src/zen/workspaces/ZenWorkspaces.mjs index 134dd01312..5d41c63264 100644 --- a/src/zen/workspaces/ZenWorkspaces.mjs +++ b/src/zen/workspaces/ZenWorkspaces.mjs @@ -233,7 +233,11 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature { gZenVerticalTabsManager._canReplaceNewTab ) { // Only set up URL bar selection if we're switching to a different tab - if (gBrowser.selectedTab !== this._emptyTab && selectURLBar) { + if ( + gBrowser.selectedTab !== this._emptyTab && + selectURLBar && + Services.prefs.getBoolPref('zen.startup.focus-urlbar', true) + ) { // Use a Promise-based approach for better sequencing const urlBarSelectionPromise = new Promise((resolve) => { const tabSelectListener = () => {