Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Add toggle to disable new tab on double click #3392

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from
1 change: 1 addition & 0 deletions src/browser/app/profile/zen-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ pref('zen.theme.gradient', true);
pref('zen.tabs.show-newtab-vertical', true);
pref('zen.view.show-newtab-button-border-top', true);
pref('zen.view.show-newtab-button-top', false);
pref("zen.tabs.openNewTabByDblclick", true);
vintydong marked this conversation as resolved.
Show resolved Hide resolved

#ifdef XP_MACOSX
pref('zen.theme.border-radius', 10); // In pixels
Expand Down
5 changes: 5 additions & 0 deletions src/browser/components/preferences/zen-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1071,4 +1071,9 @@ Preferences.addAll([
type: "bool",
default: true,
},
{
id: "zen.tabs.openNewTabByDblclick",
type: "bool",
default: true,
},
]);
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,9 @@
<checkbox id="zenLooksAndFeelShowBottomBorder"
data-l10n-id="zen-vertical-tabs-show-bottom-border"
preference="zen.view.show-bottom-border"/>
<checkbox id="zenLooksAndFeelNewTabDblClick"
data-l10n-id="zen-vertical-tabs-newtab-dbl-click"
preference="zen.tabs.openNewTabByDblclick"/>
</vbox>
</groupbox>

Expand Down
58 changes: 44 additions & 14 deletions src/browser/components/tabbrowser/content/tabs-js.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,38 @@
diff --git a/browser/components/tabbrowser/content/tabs.js b/browser/components/tabbrowser/content/tabs.js
index f9e256b143786c18ba85859ca1b11182ab23f1aa..f60a8850305f1d7c2eadb6ac6996302f42a08a8a 100644
index f9e256b143786c18ba85859ca1b11182ab23f1aa..69fd7107a9c5bf3f855ab8dbe7ee5e1d32205bb7 100644
--- a/browser/components/tabbrowser/content/tabs.js
+++ b/browser/components/tabbrowser/content/tabs.js
@@ -541,7 +541,7 @@
@@ -155,6 +155,13 @@
false
);
this.tooltip = "tabbrowser-tab-tooltip";
+
+ XPCOMUtils.defineLazyPreferenceGetter(
+ this,
+ "_openNewTabByDblclick",
+ "zen.tabs.openNewTabByDblclick",
+ true
+ );
}

attributeChangedCallback(name, oldValue, newValue) {
@@ -309,11 +316,13 @@
return;
}

- if (!this._blockDblClick) {
+ if (!this._blockDblClick && this._openNewTabByDblclick) {
BrowserCommands.openTab();
}

- event.preventDefault();
+ if(this._openNewTabByDblclick) {
+ event.preventDefault();
+ }
}

on_click(event) {
@@ -541,7 +550,7 @@
if (this.#isContainerVerticalPinnedExpanded(tab)) {
// In expanded vertical mode, the max number of pinned tabs per row is dynamic
// Set this before adjusting dragged tab's position
Expand All @@ -11,7 +41,7 @@ index f9e256b143786c18ba85859ca1b11182ab23f1aa..f60a8850305f1d7c2eadb6ac6996302f
let tabsPerRow = 0;
let position = 0;
for (let pinnedTab of pinnedTabs) {
@@ -918,7 +918,7 @@
@@ -918,7 +927,7 @@
let postTransitionCleanup = () => {
tab.removeAttribute("tabdrop-samewindow");

Expand All @@ -20,7 +50,7 @@ index f9e256b143786c18ba85859ca1b11182ab23f1aa..f60a8850305f1d7c2eadb6ac6996302f
if (dropIndex !== false) {
gBrowser.moveTabTo(tab, dropIndex);
if (incrementDropIndex) {
@@ -928,7 +928,7 @@
@@ -928,7 +937,7 @@

gBrowser.syncThrobberAnimations(tab);
};
Expand All @@ -29,7 +59,7 @@ index f9e256b143786c18ba85859ca1b11182ab23f1aa..f60a8850305f1d7c2eadb6ac6996302f
postTransitionCleanup();
} else {
let onTransitionEnd = transitionendEvent => {
@@ -1077,7 +1077,8 @@
@@ -1077,7 +1086,8 @@
if (
dt.mozUserCancelled ||
dt.dropEffect != "none" ||
Expand All @@ -39,7 +69,7 @@ index f9e256b143786c18ba85859ca1b11182ab23f1aa..f60a8850305f1d7c2eadb6ac6996302f
) {
delete draggedTab._dragData;
return;
@@ -1328,7 +1329,7 @@
@@ -1328,7 +1338,7 @@
}
}

Expand All @@ -48,7 +78,7 @@ index f9e256b143786c18ba85859ca1b11182ab23f1aa..f60a8850305f1d7c2eadb6ac6996302f
return this.#allTabs;
}

@@ -1520,10 +1521,12 @@
@@ -1520,10 +1530,12 @@

_handleTabSelect(aInstant) {
let selectedTab = this.selectedItem;
Expand All @@ -64,7 +94,7 @@ index f9e256b143786c18ba85859ca1b11182ab23f1aa..f60a8850305f1d7c2eadb6ac6996302f
selectedTab._notselectedsinceload = false;
}

@@ -1571,7 +1574,7 @@
@@ -1571,7 +1583,7 @@
if (isEndTab && !this._hasTabTempMaxWidth) {
return;
}
Expand All @@ -73,7 +103,7 @@ index f9e256b143786c18ba85859ca1b11182ab23f1aa..f60a8850305f1d7c2eadb6ac6996302f
// Force tabs to stay the same width, unless we're closing the last tab,
// which case we need to let them expand just enough so that the overall
// tabbar width is the same.
@@ -1586,7 +1589,7 @@
@@ -1586,7 +1598,7 @@
let tabsToReset = [];
for (let i = numPinned; i < tabs.length; i++) {
let tab = tabs[i];
Expand All @@ -82,7 +112,7 @@ index f9e256b143786c18ba85859ca1b11182ab23f1aa..f60a8850305f1d7c2eadb6ac6996302f
if (!isEndTab) {
// keep tabs the same width
tab.style.transition = "none";
@@ -1651,13 +1654,13 @@
@@ -1651,13 +1663,13 @@
let verticalTabsContainer = document.getElementById(
"vertical-pinned-tabs-container"
);
Expand All @@ -98,7 +128,7 @@ index f9e256b143786c18ba85859ca1b11182ab23f1aa..f60a8850305f1d7c2eadb6ac6996302f
}
}

@@ -1681,7 +1684,7 @@
@@ -1681,7 +1693,7 @@

_positionPinnedTabs() {
let tabs = this.visibleTabs;
Expand All @@ -107,7 +137,7 @@ index f9e256b143786c18ba85859ca1b11182ab23f1aa..f60a8850305f1d7c2eadb6ac6996302f
let absPositionHorizontalTabs =
this.overflowing && tabs.length > numPinned && numPinned > 0;

@@ -1762,7 +1765,7 @@
@@ -1762,7 +1774,7 @@
return;
}

Expand All @@ -116,7 +146,7 @@ index f9e256b143786c18ba85859ca1b11182ab23f1aa..f60a8850305f1d7c2eadb6ac6996302f

let directionX = screenX > dragData.animLastScreenX;
let directionY = screenY > dragData.animLastScreenY;
@@ -1948,7 +1951,7 @@
@@ -1948,7 +1960,7 @@
}

let pinned = draggedTab.pinned;
Expand All @@ -125,7 +155,7 @@ index f9e256b143786c18ba85859ca1b11182ab23f1aa..f60a8850305f1d7c2eadb6ac6996302f
let tabs = this.visibleTabs.slice(
pinned ? 0 : numPinned,
pinned ? numPinned : undefined
@@ -2140,8 +2143,8 @@
@@ -2140,8 +2152,8 @@
);
}

Expand Down
Loading