Added an Arc-like empty tab that represents no state. [zen.urlbar.replace-newtab to false to disable]

This commit is contained in:
mr. M
2025-02-19 17:26:30 +01:00
parent e75e8d170d
commit ebdc9368da
10 changed files with 224 additions and 92 deletions

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/urlbar/UrlbarInput.sys.mjs b/browser/components/urlbar/UrlbarInput.sys.mjs
index 50968dc04b527438acf30151f0c2e92f8b45097c..ff77a2407b8ca628bcad06a9822ba2dbf0d43a51 100644
index 50968dc04b527438acf30151f0c2e92f8b45097c..7f3579d39e53a36135fbabb786a6e07f4e0945b0 100644
--- a/browser/components/urlbar/UrlbarInput.sys.mjs
+++ b/browser/components/urlbar/UrlbarInput.sys.mjs
@@ -67,6 +67,13 @@ XPCOMUtils.defineLazyPreferenceGetter(
@@ -107,7 +107,17 @@ index 50968dc04b527438acf30151f0c2e92f8b45097c..ff77a2407b8ca628bcad06a9822ba2db
if (where == "current") {
where = "tab";
} else if (where == "tab") {
@@ -3859,6 +3891,11 @@ export class UrlbarInput {
@@ -3320,6 +3352,9 @@ export class UrlbarInput {
) {
where = "current";
}
+ if (this.window.gBrowser.selectedTab.hasAttribute("zen-empty-tab")) {
+ return "tab"; // Always open in a new tab if the current tab is "our empty tab".
+ }
return where;
}
@@ -3859,6 +3894,11 @@ export class UrlbarInput {
}
_on_click(event) {
@@ -119,7 +129,7 @@ index 50968dc04b527438acf30151f0c2e92f8b45097c..ff77a2407b8ca628bcad06a9822ba2db
if (
event.target == this.inputField ||
event.target == this._inputContainer ||
@@ -3930,7 +3967,7 @@ export class UrlbarInput {
@@ -3930,7 +3970,7 @@ export class UrlbarInput {
}
}
@@ -128,7 +138,7 @@ index 50968dc04b527438acf30151f0c2e92f8b45097c..ff77a2407b8ca628bcad06a9822ba2db
this.view.autoOpen({ event });
} else {
if (this._untrimOnFocusAfterKeydown) {
@@ -3970,9 +4007,12 @@ export class UrlbarInput {
@@ -3970,9 +4010,12 @@ export class UrlbarInput {
}
_on_mousedown(event) {
@@ -142,7 +152,7 @@ index 50968dc04b527438acf30151f0c2e92f8b45097c..ff77a2407b8ca628bcad06a9822ba2db
if (
event.target != this.inputField &&
@@ -3982,8 +4022,8 @@ export class UrlbarInput {
@@ -3982,8 +4025,8 @@ export class UrlbarInput {
break;
}