diff --git a/configs/common/mozconfig b/configs/common/mozconfig index fa6ada7ea..1bc855b0b 100644 --- a/configs/common/mozconfig +++ b/configs/common/mozconfig @@ -94,8 +94,8 @@ mk_add_options MOZ_SERVICES_HEALTHREPORT=0 mk_add_options MOZ_TELEMETRY_REPORTING=0 # Allow loading unsigned extensions -export MOZ_REQUIRE_SIGNING=1 -mk_add_options MOZ_REQUIRE_SIGNING=1 +export MOZ_REQUIRE_SIGNING= +mk_add_options MOZ_REQUIRE_SIGNING= # Sorry ptr, I didnt mean to! ac_add_options --without-wasm-sandboxed-libraries diff --git a/src/browser/base/content/zen-components b/src/browser/base/content/zen-components index 0e9849bab..f34947772 160000 --- a/src/browser/base/content/zen-components +++ b/src/browser/base/content/zen-components @@ -1 +1 @@ -Subproject commit 0e9849bab892f0546bcd4b7eface3603fd0715f4 +Subproject commit f34947772806602fdac3913f75995265ce25ccb4 diff --git a/src/browser/components/preferences/preferences-js.patch b/src/browser/components/preferences/preferences-js.patch index 600d7e46a..499fce7fb 100644 --- a/src/browser/components/preferences/preferences-js.patch +++ b/src/browser/components/preferences/preferences-js.patch @@ -1,13 +1,14 @@ diff --git a/browser/components/preferences/preferences.js b/browser/components/preferences/preferences.js -index 7e21bab426b6eb52fe84876d817fddbdb1a35ffc..fe23eb36a28a2baa4facad80a776e739ee6e43b1 100644 +index 7e21bab426b6eb52fe84876d817fddbdb1a35ffc..fb7c6f419c02701aecd148ef2fe271ed6f1a73c1 100644 --- a/browser/components/preferences/preferences.js +++ b/browser/components/preferences/preferences.js -@@ -196,6 +196,8 @@ function init_all() { +@@ -196,6 +196,9 @@ function init_all() { // the entire document. Preferences.queueUpdateOfAllElements(); Services.telemetry.setEventRecordingEnabled("aboutpreferences", true); + register_module("paneZenLooks", gZenLooksAndFeel); + register_module("paneZenWorkspaces", gZenWorkspacesSettings); ++ register_module("paneZenCKS", gZenCKSSettings); register_module("paneGeneral", gMainPane); register_module("paneHome", gHomePane); diff --git a/src/browser/components/preferences/preferences-xhtml.patch b/src/browser/components/preferences/preferences-xhtml.patch index 02ddfbddb..45c2105a4 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 3affb19d1a243da4a5782c9a4a5588d165b4119f..ccb56cc323ff5c3e94013de782af54911fc0c360 100644 +index 3affb19d1a243da4a5782c9a4a5588d165b4119f..6fdc0c4447d2d43ee5f4563c725b6eca1cf7acc5 100644 --- a/browser/components/preferences/preferences.xhtml +++ b/browser/components/preferences/preferences.xhtml @@ -43,6 +43,8 @@ @@ -24,7 +24,7 @@ index 3affb19d1a243da4a5782c9a4a5588d165b4119f..ccb56cc323ff5c3e94013de782af5491 @@ -49,11 +49,22 @@ index 3affb19d1a243da4a5782c9a4a5588d165b4119f..ccb56cc323ff5c3e94013de782af5491 + + + ++ ++ ++ ++ ++ + @@ -67,11 +78,12 @@ index 3affb19d1a243da4a5782c9a4a5588d165b4119f..ccb56cc323ff5c3e94013de782af5491 -@@ -246,6 +278,8 @@ +@@ -246,6 +289,9 @@ #include sync.inc.xhtml #include experimental.inc.xhtml #include moreFromMozilla.inc.xhtml +#include zenLooksAndFeel.inc.xhtml ++#include zenKeyboardShortcuts.inc.xhtml +#include zenWorkspaces.inc.xhtml diff --git a/src/browser/components/preferences/zen-settings.js b/src/browser/components/preferences/zen-settings.js index a73e03c26..d57278c48 100644 --- a/src/browser/components/preferences/zen-settings.js +++ b/src/browser/components/preferences/zen-settings.js @@ -19,6 +19,7 @@ var gZenLooksAndFeel = { init() { this._initializeColorPicker(this._getInitialAccentColor()); window.zenPageAccentColorChanged = this._handleAccentColorChange.bind(this); + gZenThemeBuilder.init(); }, _initializeColorPicker(accentColor) { @@ -56,6 +57,127 @@ var gZenWorkspacesSettings = { }, }; +var gZenCKSSettings = { + init() { + this._currentAction = null; + this._initializeEvents(); + this._initializeCKS(); + }, + + _initializeCKS() { + let wrapepr = document.getElementById("zenCKSOptions-wrapper"); + + // Create the groups first. + for (let key in kZKSActions) { + const data = kZKSActions[key]; + const group = data[2]; + if (!wrapepr.querySelector(`[data-group="${group}"]`)) { + let groupElem = document.createElement("h2"); + groupElem.setAttribute("data-group", group); + document.l10n.setAttributes(groupElem, `zen-cks-group-${group}`); + wrapepr.appendChild(groupElem); + } + } + + const keys = Object.keys(kZKSActions); + for (let i = keys.length - 1; i >= 0; i--) { + const key = keys[i]; + const data = kZKSActions[key]; + const l10nId = data[1]; + const group = data[2]; + let fragment = window.MozXULElement.parseXULToFragment(` + + + + + `); + document.l10n.setAttributes(fragment.querySelector(".zenCKSOption-label"), l10nId); + + const input = fragment.querySelector(".zenCKSOption-input"); + const shortcut = gZenKeyboardShortcuts.getShortcut(key); + if (shortcut) { + input.value = gZenKeyboardShortcuts.shortCutToString(shortcut); + } else { + this._resetCKS(input, key); + } + + input.setAttribute("data-key", key); + input.addEventListener("focusin", (event) => { + const key = event.target.getAttribute("data-key"); + this._currentAction = key; + event.target.classList.add("zenCKSOption-input-editing"); + }); + + input.addEventListener("blur", (event) => { + this._currentAction = null; + event.target.classList.remove("zenCKSOption-input-editing"); + }); + + const groupElem = wrapepr.querySelector(`[data-group="${group}"]`); + groupElem.after(fragment); + } + }, + + _resetCKS(input, key) { + input.value = "Not set"; + input.classList.add("zenCKSOption-input-not-set"); + input.classList.remove("zenCKSOption-input-invalid"); + gZenKeyboardShortcuts.setShortcut(key, null); + }, + + _initializeEvents() { + window.addEventListener("keydown", this._handleKeyDown.bind(this)); + }, + + _handleKeyDown(event) { + if (!this._currentAction) { + return; + } + + let input = document.querySelector(`.zenCKSOption-input[data-key="${this._currentAction}"]`); + let shortcut = { + ctrl: event.ctrlKey, + alt: event.altKey, + shift: event.shiftKey, + meta: event.metaKey + }; + + if (!shortcut.ctrl && !shortcut.alt && !shortcut.shift && !shortcut.meta) { + this._resetCKS(input, this._currentAction); + return; // No modifiers, ignore. + } + + if (!(["Control", "Alt", "Meta", "Shift"].includes(event.key))) { + if (event.keycode) { + shortcut.keycode = event.keycode; + } else { + shortcut.key = event.key; + } + } + + if (event.key === "Escape" || event.key === "Tab") { + this._currentAction = null; + input.classList.remove("zenCKSOption-input-editing"); + return; + } else if (event.key === "Backspace") { + this._resetCKS(input, this._currentAction); + return; + } + + event.preventDefault(); + gZenKeyboardShortcuts.setShortcut(this._currentAction, shortcut); + + input.value = gZenKeyboardShortcuts.shortCutToString(shortcut); + input.classList.remove("zenCKSOption-input-not-set"); + + if (gZenKeyboardShortcuts.isValidShortcut(shortcut)) { + input.classList.remove("zenCKSOption-input-invalid"); + } else { + input.classList.add("zenCKSOption-input-invalid"); + } + }, +}; + Preferences.addAll([ { id: "zen.theme.toolbar-themed", diff --git a/src/browser/components/preferences/zenKeyboardShortcuts.inc.xhtml b/src/browser/components/preferences/zenKeyboardShortcuts.inc.xhtml new file mode 100644 index 000000000..390a25e9a --- /dev/null +++ b/src/browser/components/preferences/zenKeyboardShortcuts.inc.xhtml @@ -0,0 +1,23 @@ +