From f7031d803ccee5762a742cb47d34ed1c52e9880a Mon Sep 17 00:00:00 2001 From: Mauro Balades Date: Sat, 13 Apr 2024 10:56:42 +0200 Subject: [PATCH] Added custom theme modifiers to all about pages --- .../base/content/aboutDialog-xhtml.patch | 12 ++++ .../content/aboutRestartRequired-xhtml.patch | 12 ++++ src/browser/base/content/browser-xhtml.patch | 17 ++++-- .../base/content/zen-scripts.jar.inc.mn | 3 +- src/browser/base/content/zenThemeModifier.js | 60 +++++++++++++++++++ .../content/aboutLogins-html.patch | 13 ++++ .../abouthomecache/page-html-template.patch | 12 ++++ .../preferences/preferences-xhtml.patch | 14 ++++- .../content/aboutSessionRestore-xhtml.patch | 12 ++++ .../themes/shared/zen-browser-shared.css | 7 ++- .../content/aboutconfig-html.patch | 12 ++++ .../content/aboutProcesses-html.patch | 12 ++++ .../printing/content/print-html.patch | 12 ++++ .../prompts/content/commonDialog-xhtml.patch | 12 ++++ src/toolkit/content/aboutAbout-html.patch | 12 ++++ src/toolkit/content/aboutProfiles-xhtml.patch | 12 ++++ src/toolkit/content/aboutSupport-xhtml.patch | 12 ++++ .../extensions/content/aboutaddons-html.patch | 12 ++++ .../shared/in-content/zen-common-shared.css | 2 +- src/toolkit/themes/shared/zen-popup.css | 7 ++- 20 files changed, 255 insertions(+), 12 deletions(-) create mode 100644 src/browser/base/content/aboutDialog-xhtml.patch create mode 100644 src/browser/base/content/aboutRestartRequired-xhtml.patch create mode 100644 src/browser/base/content/zenThemeModifier.js create mode 100644 src/browser/components/aboutlogins/content/aboutLogins-html.patch create mode 100644 src/browser/components/newtab/data/content/abouthomecache/page-html-template.patch create mode 100644 src/browser/components/sessionstore/content/aboutSessionRestore-xhtml.patch create mode 100644 src/toolkit/components/aboutconfig/content/aboutconfig-html.patch create mode 100644 src/toolkit/components/aboutprocesses/content/aboutProcesses-html.patch create mode 100644 src/toolkit/components/printing/content/print-html.patch create mode 100644 src/toolkit/components/prompts/content/commonDialog-xhtml.patch create mode 100644 src/toolkit/content/aboutAbout-html.patch create mode 100644 src/toolkit/content/aboutProfiles-xhtml.patch create mode 100644 src/toolkit/content/aboutSupport-xhtml.patch create mode 100644 src/toolkit/mozapps/extensions/content/aboutaddons-html.patch diff --git a/src/browser/base/content/aboutDialog-xhtml.patch b/src/browser/base/content/aboutDialog-xhtml.patch new file mode 100644 index 000000000..a20f20e5e --- /dev/null +++ b/src/browser/base/content/aboutDialog-xhtml.patch @@ -0,0 +1,12 @@ +diff --git a/browser/base/content/aboutDialog.xhtml b/browser/base/content/aboutDialog.xhtml +index e0fcce367abe57e03e54779437facbba4326687b..7d57f10cfe6bd8435e45f0ffc806bd76b475e403 100644 +--- a/browser/base/content/aboutDialog.xhtml ++++ b/browser/base/content/aboutDialog.xhtml +@@ -36,6 +36,7 @@ + + + ++ + + + diff --git a/src/browser/base/content/aboutRestartRequired-xhtml.patch b/src/browser/base/content/aboutRestartRequired-xhtml.patch new file mode 100644 index 000000000..a80dcafc5 --- /dev/null +++ b/src/browser/base/content/aboutRestartRequired-xhtml.patch @@ -0,0 +1,12 @@ +diff --git a/browser/base/content/aboutRestartRequired.xhtml b/browser/base/content/aboutRestartRequired.xhtml +index c1f42b4ddd3b154a8643fc5265c556904805bdff..9722e7de76b02077addfeda90a9acd8b921a9cd6 100644 +--- a/browser/base/content/aboutRestartRequired.xhtml ++++ b/browser/base/content/aboutRestartRequired.xhtml +@@ -29,6 +29,7 @@ + /> + + ++ + + + diff --git a/src/browser/base/content/browser-xhtml.patch b/src/browser/base/content/browser-xhtml.patch index 028032695..85c12523c 100644 --- a/src/browser/base/content/browser-xhtml.patch +++ b/src/browser/base/content/browser-xhtml.patch @@ -1,18 +1,25 @@ diff --git a/browser/base/content/browser.xhtml b/browser/base/content/browser.xhtml -index b4886fb5f74568b4c09eb620be9efb74e39c599c..0993ee1258dfd83ade68500f11dc2e833df4ae51 100644 +index b4886fb5f74568b4c09eb620be9efb74e39c599c..534e40c8f65d1b626c11aa3cfea308cc6176be02 100644 --- a/browser/base/content/browser.xhtml +++ b/browser/base/content/browser.xhtml -@@ -163,9 +163,15 @@ +@@ -127,6 +127,7 @@ + Services.scriptloader.loadSubScript("chrome://browser/content/search/autocomplete-popup.js", this); + Services.scriptloader.loadSubScript("chrome://browser/content/search/searchbar.js", this); + Services.scriptloader.loadSubScript("chrome://browser/content/shopping/shopping-sidebar.js", this); ++ Services.scriptloader.loadSubScript("chrome://browser/content/zenThemeModifier.js", this); + + window.onload = gBrowserInit.onLoad.bind(gBrowserInit); + window.onunload = gBrowserInit.onUnload.bind(gBrowserInit); +@@ -163,9 +164,15 @@ -#include navigator-toolbox.inc.xhtml -- --#include browser-box.inc.xhtml + +#include titlebar-items.inc.xhtml + -+ + +-#include browser-box.inc.xhtml + + #include navigator-toolbox.inc.xhtml + #include zen-sidebar-box.inc.xhtml diff --git a/src/browser/base/content/zen-scripts.jar.inc.mn b/src/browser/base/content/zen-scripts.jar.inc.mn index 80edd0062..77ae61dca 100644 --- a/src/browser/base/content/zen-scripts.jar.inc.mn +++ b/src/browser/base/content/zen-scripts.jar.inc.mn @@ -1,2 +1,3 @@ content/browser/zen-browser-places.js (content/zen-browser-places.js) - content/browser/zen-browser.js (content/zen-browser.js) \ No newline at end of file + content/browser/zen-browser.js (content/zen-browser.js) + content/browser/zenThemeModifier.js (content/zenThemeModifier.js) \ No newline at end of file diff --git a/src/browser/base/content/zenThemeModifier.js b/src/browser/base/content/zenThemeModifier.js new file mode 100644 index 000000000..778a42f46 --- /dev/null +++ b/src/browser/base/content/zenThemeModifier.js @@ -0,0 +1,60 @@ + +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + + "use strict"; + +/* INCLUDE THIS FILE AS: + * + * + * FOR ANY WEBSITE THAT WOULD NEED TO USE THE ACCENT COLOR, ETC + */ + + { + const kZenThemeAccentColorPref = "zen.theme.accent-color"; + + /** + * ZenThemeModifier controls the application of theme data to the browser, + * for examplem, it injects the accent color to the document. This is used + * because we need a way to apply the accent color without having to worry about + * shadow roots not inheriting the accent color. + * + * note: It must be a firefox builtin page with access to the browser's configuration + * and services. + */ + const ZenThemeModifier = { + /** + * Listen for theming updates from the LightweightThemeChild actor, and + * begin listening to changes in preferred color scheme. + */ + init() { + addEventListener("LightweightTheme:Set", this); + Services.prefs.addObserver(kZenThemeAccentColorPref, this.handleEvent.bind(this)); + this.updateAllThemeBasics(); + }, + + handleEvent(event) { + // note: even might be undefined, but we shoudnt use it! + this.updateAllThemeBasics(); + }, + + /** + * Update all theme basics, like the accent color. + */ + updateAllThemeBasics() { + this.updateAccentColor(); + }, + + /** + * Update the accent color. + */ + updateAccentColor() { + const accentColor = Services.prefs.getStringPref(kZenThemeAccentColorPref, "#0b57d0"); + document.documentElement.style.setProperty("--zen-primary-color", accentColor); + }, + + }; + ZenThemeModifier.init(); + } + diff --git a/src/browser/components/aboutlogins/content/aboutLogins-html.patch b/src/browser/components/aboutlogins/content/aboutLogins-html.patch new file mode 100644 index 000000000..e65fb9541 --- /dev/null +++ b/src/browser/components/aboutlogins/content/aboutLogins-html.patch @@ -0,0 +1,13 @@ +diff --git a/browser/components/aboutlogins/content/aboutLogins.html b/browser/components/aboutlogins/content/aboutLogins.html +index 67712c8f296ba8a916ff4c6ecf9179ad733b2df8..0bad556640afd48a6738e2955a93c4e8faa68823 100644 +--- a/browser/components/aboutlogins/content/aboutLogins.html ++++ b/browser/components/aboutlogins/content/aboutLogins.html +@@ -6,7 +6,7 @@ + + + +- ++ + + + diff --git a/src/browser/components/newtab/data/content/abouthomecache/page-html-template.patch b/src/browser/components/newtab/data/content/abouthomecache/page-html-template.patch new file mode 100644 index 000000000..cb95ca6a1 --- /dev/null +++ b/src/browser/components/newtab/data/content/abouthomecache/page-html-template.patch @@ -0,0 +1,12 @@ +diff --git a/browser/components/newtab/data/content/abouthomecache/page.html.template b/browser/components/newtab/data/content/abouthomecache/page.html.template +index 60898ed6b82ec298198cb9529387f4efd8561cc1..fbd93ccc7ee3619415192164a55f5fcbfd387a51 100644 +--- a/browser/components/newtab/data/content/abouthomecache/page.html.template ++++ b/browser/components/newtab/data/content/abouthomecache/page.html.template +@@ -32,6 +32,7 @@ + + + ++ + + + diff --git a/src/browser/components/preferences/preferences-xhtml.patch b/src/browser/components/preferences/preferences-xhtml.patch index c2f63b805..4df149129 100644 --- a/src/browser/components/preferences/preferences-xhtml.patch +++ b/src/browser/components/preferences/preferences-xhtml.patch @@ -1,5 +1,5 @@ diff --git a/browser/components/preferences/preferences.xhtml b/browser/components/preferences/preferences.xhtml -index 38fba9a7265cbcec406fd4145014083286fa798e..38281e4fc127543052064020ebf14ad0e72abda5 100644 +index 38fba9a7265cbcec406fd4145014083286fa798e..c54b900f0329c95ae706eb6df42fd7f7e2dc41c9 100644 --- a/browser/components/preferences/preferences.xhtml +++ b/browser/components/preferences/preferences.xhtml @@ -42,6 +42,10 @@ @@ -21,7 +21,15 @@ index 38fba9a7265cbcec406fd4145014083286fa798e..38281e4fc127543052064020ebf14ad0 -@@ -111,6 +116,17 @@ +@@ -84,6 +89,7 @@ + + + + + diff --git a/src/browser/themes/shared/zen-browser-shared.css b/src/browser/themes/shared/zen-browser-shared.css index dce3f00ac..e83d24844 100644 --- a/src/browser/themes/shared/zen-browser-shared.css +++ b/src/browser/themes/shared/zen-browser-shared.css @@ -247,7 +247,6 @@ toolbarbutton#scrollbutton-up { padding: 0 !important; align-items: center; animation: zen-slide-in 0.3s; - transition: .1s transform; } .tabbrowser-tab:active { @@ -325,6 +324,12 @@ toolbarbutton#scrollbutton-up { margin-inline-end: 0 !important; } +#tabbrowser-arrowscrollbox { + &::part(scrollbox-clip) { + max-height: 62vh; + } +} + /* Title bar */ #zen-titlebar-items-container { diff --git a/src/toolkit/components/aboutconfig/content/aboutconfig-html.patch b/src/toolkit/components/aboutconfig/content/aboutconfig-html.patch new file mode 100644 index 000000000..a54a94475 --- /dev/null +++ b/src/toolkit/components/aboutconfig/content/aboutconfig-html.patch @@ -0,0 +1,12 @@ +diff --git a/toolkit/components/aboutconfig/content/aboutconfig.html b/toolkit/components/aboutconfig/content/aboutconfig.html +index 8962cdd86d802f536dbef9cad8928d3e7a4eebf6..b99119d95cd575abead5d3d3f720244f5fe45b3b 100644 +--- a/toolkit/components/aboutconfig/content/aboutconfig.html ++++ b/toolkit/components/aboutconfig/content/aboutconfig.html +@@ -34,6 +34,7 @@ + + + ++ + + +
+ + ++ + + + diff --git a/src/toolkit/components/printing/content/print-html.patch b/src/toolkit/components/printing/content/print-html.patch new file mode 100644 index 000000000..ab5d5abb1 --- /dev/null +++ b/src/toolkit/components/printing/content/print-html.patch @@ -0,0 +1,12 @@ +diff --git a/toolkit/components/printing/content/print.html b/toolkit/components/printing/content/print.html +index 62d214608c24191fea013db23e96b4ae2a4042e6..59b146a594f0f882435f2d29795a65020db01f48 100644 +--- a/toolkit/components/printing/content/print.html ++++ b/toolkit/components/printing/content/print.html +@@ -21,6 +21,7 @@ + type="module" + src="chrome://global/content/elements/moz-button-group.mjs" + > ++ + + + diff --git a/src/toolkit/components/prompts/content/commonDialog-xhtml.patch b/src/toolkit/components/prompts/content/commonDialog-xhtml.patch new file mode 100644 index 000000000..65621ae30 --- /dev/null +++ b/src/toolkit/components/prompts/content/commonDialog-xhtml.patch @@ -0,0 +1,12 @@ +diff --git a/toolkit/components/prompts/content/commonDialog.xhtml b/toolkit/components/prompts/content/commonDialog.xhtml +index def3b93956ea9b9bfab5791b06040769dbda4645..ab9c61a5d816d17fb3f09c88514aca5ec0d2f193 100644 +--- a/toolkit/components/prompts/content/commonDialog.xhtml ++++ b/toolkit/components/prompts/content/commonDialog.xhtml +@@ -28,6 +28,7 @@ + + + ++ + + ++ + + + diff --git a/src/toolkit/content/aboutProfiles-xhtml.patch b/src/toolkit/content/aboutProfiles-xhtml.patch new file mode 100644 index 000000000..422f8b215 --- /dev/null +++ b/src/toolkit/content/aboutProfiles-xhtml.patch @@ -0,0 +1,12 @@ +diff --git a/toolkit/content/aboutProfiles.xhtml b/toolkit/content/aboutProfiles.xhtml +index 3ce9e580627d757e9bb3fa09601e6336e2376c73..cd69facbf05c525de061c496e08dc12096692e86 100644 +--- a/toolkit/content/aboutProfiles.xhtml ++++ b/toolkit/content/aboutProfiles.xhtml +@@ -27,6 +27,7 @@ + + + +

diff --git a/src/toolkit/content/aboutSupport-xhtml.patch b/src/toolkit/content/aboutSupport-xhtml.patch new file mode 100644 index 000000000..1182befd3 --- /dev/null +++ b/src/toolkit/content/aboutSupport-xhtml.patch @@ -0,0 +1,12 @@ +diff --git a/toolkit/content/aboutSupport.xhtml b/toolkit/content/aboutSupport.xhtml +index d3de7d001973434c09deb5723e73ea72f134362b..736b4e7e647d2f80697a0721c765d2aa82507583 100644 +--- a/toolkit/content/aboutSupport.xhtml ++++ b/toolkit/content/aboutSupport.xhtml +@@ -27,6 +27,7 @@ + #ifndef ANDROID + + #endif ++ + + + diff --git a/src/toolkit/mozapps/extensions/content/aboutaddons-html.patch b/src/toolkit/mozapps/extensions/content/aboutaddons-html.patch new file mode 100644 index 000000000..2c6b4f5c5 --- /dev/null +++ b/src/toolkit/mozapps/extensions/content/aboutaddons-html.patch @@ -0,0 +1,12 @@ +diff --git a/toolkit/mozapps/extensions/content/aboutaddons.html b/toolkit/mozapps/extensions/content/aboutaddons.html +index 55d6625c0847b9ae9d4f847ad978e8dc62f98c70..4d3179c3eb04fc5d2e5e34e646aba029a7118ebc 100644 +--- a/toolkit/mozapps/extensions/content/aboutaddons.html ++++ b/toolkit/mozapps/extensions/content/aboutaddons.html +@@ -76,6 +76,7 @@ + type="module" + src="chrome://global/content/elements/moz-five-star.mjs" + > ++ + + + diff --git a/src/toolkit/themes/shared/in-content/zen-common-shared.css b/src/toolkit/themes/shared/in-content/zen-common-shared.css index 8dbeeca95..057a1163f 100644 --- a/src/toolkit/themes/shared/in-content/zen-common-shared.css +++ b/src/toolkit/themes/shared/in-content/zen-common-shared.css @@ -10,7 +10,7 @@ */ /** Primary color will be injected by the theme as `--zen-primary-color` */ - --zen-primary-color: #0b57d0; /* This is the default blue color */ + --zen-primary-color: #0b57d0; /* This is the default blue color, in case the theme doesn't provide a primary color */ /** Zen colors are generated automatically from the primary color */ --zen-colors-primary: color-mix(in srgb, var(--zen-primary-color) 50%, black 50%); diff --git a/src/toolkit/themes/shared/zen-popup.css b/src/toolkit/themes/shared/zen-popup.css index 0712477a8..ebe5a0d84 100644 --- a/src/toolkit/themes/shared/zen-popup.css +++ b/src/toolkit/themes/shared/zen-popup.css @@ -232,7 +232,12 @@ panel { box-shadow: none; } -toolbarbutton:not(#appMenu-fxa-label2, .subviewbutton-iconic), +toolbarbutton:not( + #appMenu-fxa-label2, + .subviewbutton-iconic, + .zen-sidebar-action-button, + .all-tabs-close-button +), #PanelUI-zen-profiles menuitem { /** ADD HERE ALL TYPES OF BUTTONS THAT WANT TO LOOK CHROME LIKE!!! */ margin-left: 0 !important;