mirror of
https://github.com/zen-browser/desktop.git
synced 2025-09-05 19:08:18 +00:00
feat: Added zen.tabs.open-pinned-in-new-tab
pref, b=no-bug, c=common, compact-mode, folders
This commit is contained in:
@@ -25,3 +25,6 @@
|
||||
|
||||
- name: zen.startup.smooth-scroll-in-tabs
|
||||
value: true
|
||||
|
||||
- name: zen.tabs.open-pinned-in-new-tab
|
||||
value: true
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git a/browser/components/urlbar/UrlbarInput.sys.mjs b/browser/components/urlbar/UrlbarInput.sys.mjs
|
||||
index db1a780f36d16c1b63ad50af76887b16e88ca8fe..7feb0444d8628dd1aa3a4fa99b439b4a45dcb08d 100644
|
||||
index db1a780f36d16c1b63ad50af76887b16e88ca8fe..440ef03a7a43d6848c371fbe0cac62cfca59af8e 100644
|
||||
--- a/browser/components/urlbar/UrlbarInput.sys.mjs
|
||||
+++ b/browser/components/urlbar/UrlbarInput.sys.mjs
|
||||
@@ -68,6 +68,13 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
||||
@@ -166,7 +166,15 @@ index db1a780f36d16c1b63ad50af76887b16e88ca8fe..7feb0444d8628dd1aa3a4fa99b439b4a
|
||||
: val;
|
||||
// Only trim value if the directionality doesn't change to RTL and we're not
|
||||
// showing a strikeout https protocol.
|
||||
@@ -3459,6 +3522,10 @@ export class UrlbarInput {
|
||||
@@ -3307,6 +3370,7 @@ export class UrlbarInput {
|
||||
resultDetails = null,
|
||||
browser = this.window.gBrowser.selectedBrowser
|
||||
) {
|
||||
+ openUILinkWhere = this.window.gZenUIManager.getOpenUILinkWhere(url, browser, openUILinkWhere);
|
||||
// No point in setting these because we'll handleRevert() a few rows below.
|
||||
if (openUILinkWhere == "current") {
|
||||
// Make sure URL is formatted properly (don't show punycode).
|
||||
@@ -3459,6 +3523,10 @@ export class UrlbarInput {
|
||||
}
|
||||
reuseEmpty = true;
|
||||
}
|
||||
@@ -177,7 +185,7 @@ index db1a780f36d16c1b63ad50af76887b16e88ca8fe..7feb0444d8628dd1aa3a4fa99b439b4a
|
||||
if (
|
||||
where == "tab" &&
|
||||
reuseEmpty &&
|
||||
@@ -3466,6 +3533,9 @@ export class UrlbarInput {
|
||||
@@ -3466,6 +3534,9 @@ export class UrlbarInput {
|
||||
) {
|
||||
where = "current";
|
||||
}
|
||||
@@ -187,7 +195,7 @@ index db1a780f36d16c1b63ad50af76887b16e88ca8fe..7feb0444d8628dd1aa3a4fa99b439b4a
|
||||
return where;
|
||||
}
|
||||
|
||||
@@ -3723,6 +3793,7 @@ export class UrlbarInput {
|
||||
@@ -3723,6 +3794,7 @@ export class UrlbarInput {
|
||||
this.setResultForCurrentValue(null);
|
||||
this.handleCommand();
|
||||
this.controller.clearLastQueryContextCache();
|
||||
@@ -195,7 +203,7 @@ index db1a780f36d16c1b63ad50af76887b16e88ca8fe..7feb0444d8628dd1aa3a4fa99b439b4a
|
||||
|
||||
this._suppressStartQuery = false;
|
||||
});
|
||||
@@ -3730,7 +3801,6 @@ export class UrlbarInput {
|
||||
@@ -3730,7 +3802,6 @@ export class UrlbarInput {
|
||||
contextMenu.addEventListener("popupshowing", () => {
|
||||
// Close the results pane when the input field contextual menu is open,
|
||||
// because paste and go doesn't want a result selection.
|
||||
@@ -203,7 +211,7 @@ index db1a780f36d16c1b63ad50af76887b16e88ca8fe..7feb0444d8628dd1aa3a4fa99b439b4a
|
||||
|
||||
let controller =
|
||||
this.document.commandDispatcher.getControllerForCommand("cmd_paste");
|
||||
@@ -4138,6 +4208,7 @@ export class UrlbarInput {
|
||||
@@ -4138,6 +4209,7 @@ export class UrlbarInput {
|
||||
|
||||
this.document.l10n.setAttributes(
|
||||
this.inputField,
|
||||
@@ -211,7 +219,7 @@ index db1a780f36d16c1b63ad50af76887b16e88ca8fe..7feb0444d8628dd1aa3a4fa99b439b4a
|
||||
l10nId,
|
||||
l10nId == "urlbar-placeholder-with-name" ? { name } : undefined
|
||||
);
|
||||
@@ -4249,6 +4320,11 @@ export class UrlbarInput {
|
||||
@@ -4249,6 +4321,11 @@ export class UrlbarInput {
|
||||
}
|
||||
|
||||
_on_click(event) {
|
||||
@@ -223,7 +231,7 @@ index db1a780f36d16c1b63ad50af76887b16e88ca8fe..7feb0444d8628dd1aa3a4fa99b439b4a
|
||||
if (
|
||||
event.target == this.inputField ||
|
||||
event.target == this._inputContainer ||
|
||||
@@ -4320,7 +4396,7 @@ export class UrlbarInput {
|
||||
@@ -4320,7 +4397,7 @@ export class UrlbarInput {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,7 +240,7 @@ index db1a780f36d16c1b63ad50af76887b16e88ca8fe..7feb0444d8628dd1aa3a4fa99b439b4a
|
||||
this.view.autoOpen({ event });
|
||||
} else {
|
||||
if (this._untrimOnFocusAfterKeydown) {
|
||||
@@ -4360,9 +4436,16 @@ export class UrlbarInput {
|
||||
@@ -4360,9 +4437,16 @@ export class UrlbarInput {
|
||||
}
|
||||
|
||||
_on_mousedown(event) {
|
||||
@@ -250,7 +258,7 @@ index db1a780f36d16c1b63ad50af76887b16e88ca8fe..7feb0444d8628dd1aa3a4fa99b439b4a
|
||||
|
||||
if (
|
||||
event.target != this.inputField &&
|
||||
@@ -4374,6 +4457,10 @@ export class UrlbarInput {
|
||||
@@ -4374,6 +4458,10 @@ export class UrlbarInput {
|
||||
|
||||
this.focusedViaMousedown = !this.focused;
|
||||
this._preventClickSelectsAll = this.focused;
|
||||
@@ -261,7 +269,7 @@ index db1a780f36d16c1b63ad50af76887b16e88ca8fe..7feb0444d8628dd1aa3a4fa99b439b4a
|
||||
|
||||
// Keep the focus status, since the attribute may be changed
|
||||
// upon calling this.focus().
|
||||
@@ -4414,7 +4501,7 @@ export class UrlbarInput {
|
||||
@@ -4414,7 +4502,7 @@ export class UrlbarInput {
|
||||
}
|
||||
// Don't close the view when clicking on a tab; we may want to keep the
|
||||
// view open on tab switch, and the TabSelect event arrived earlier.
|
||||
|
@@ -490,6 +490,30 @@ var gZenUIManager = {
|
||||
? 'bottomleft topleft'
|
||||
: 'bottomright topright';
|
||||
},
|
||||
|
||||
urlStringsDomainMatch(url1, url2) {
|
||||
if (!url1.startsWith('http') || !url2?.startsWith('http')) {
|
||||
return false;
|
||||
}
|
||||
return Services.io.newURI(url1).host === Services.io.newURI(url2).host;
|
||||
},
|
||||
|
||||
getOpenUILinkWhere(url, browser, openUILinkWhere) {
|
||||
try {
|
||||
let tab = gBrowser.getTabForBrowser(browser);
|
||||
if (
|
||||
openUILinkWhere === 'current' &&
|
||||
!this.urlStringsDomainMatch(url, browser.currentURI.spec) &&
|
||||
tab.pinned &&
|
||||
Services.prefs.getBoolPref('zen.tabs.open-pinned-in-new-tab')
|
||||
) {
|
||||
return 'tab';
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Error in getOpenUILinkWhere:', e);
|
||||
}
|
||||
return openUILinkWhere;
|
||||
},
|
||||
};
|
||||
|
||||
var gZenVerticalTabsManager = {
|
||||
|
@@ -17,7 +17,7 @@
|
||||
}
|
||||
|
||||
#urlbar {
|
||||
--urlbarView-separator-color: light-dark(hsl(0, 0%, 74.9%), hsl(0, 0%, 20%));
|
||||
--urlbarView-separator-color: light-dark(hsl(0, 0%, 55%), hsl(0, 0%, 20%));
|
||||
--urlbarView-hover-background: var(--toolbarbutton-hover-background);
|
||||
--urlbarView-highlight-background: var(--toolbarbutton-hover-background);
|
||||
border-radius: calc(var(--toolbarbutton-border-radius) - 2px);
|
||||
@@ -545,7 +545,7 @@ button.popup-notification-dropmarker {
|
||||
.urlbarView-title-separator::before {
|
||||
font-size: 14px !important;
|
||||
font-weight: 500 !important;
|
||||
color: #aaa !important;
|
||||
color: light-dark(#4f4f4f, #aaa) !important;
|
||||
}
|
||||
|
||||
.urlbarView-favicon {
|
||||
|
@@ -52,6 +52,7 @@
|
||||
--zen-compact-float: var(--zen-element-separation);
|
||||
:root[zen-no-padding='true'] & {
|
||||
--zen-compact-float: 10px;
|
||||
--zen-compact-mode-no-padding-radius-fix: 2px;
|
||||
}
|
||||
|
||||
/* Initial padding for when we are animating */
|
||||
@@ -152,7 +153,7 @@
|
||||
box-shadow: var(--zen-big-shadow);
|
||||
pointer-events: none;
|
||||
z-index: -1;
|
||||
border-radius: calc(var(--zen-native-inner-radius) + var(--zen-element-separation) / 4);
|
||||
border-radius: calc(var(--zen-native-inner-radius) + var(--zen-element-separation) / 4 - var(--zen-compact-mode-no-padding-radius-fix, 0px));
|
||||
@media -moz-pref('zen.view.compact.color-sidebar') {
|
||||
background: var(--zen-main-browser-background-toolbar) !important;
|
||||
background-attachment: fixed !important;
|
||||
|
@@ -184,7 +184,7 @@ zen-folder {
|
||||
);
|
||||
--zen-folder-front-bgcolor: light-dark(
|
||||
color-mix(in srgb, var(--zen-primary-color), white 70%),
|
||||
color-mix(in srgb, var(--zen-primary-color), black 20%)
|
||||
color-mix(in srgb, var(--zen-primary-color), black 40%)
|
||||
);
|
||||
--zen-folder-stroke: light-dark(
|
||||
color-mix(in srgb, var(--zen-primary-color) 60%, black),
|
||||
|
Reference in New Issue
Block a user