chore: Rewrite prefs in rust, p=(#9491), c=workflows, winsign

This commit is contained in:
mr. m
2025-07-16 17:09:16 +02:00
committed by GitHub
parent f8be01fe59
commit 982e194a98
60 changed files with 1303 additions and 510 deletions

1
.gitignore vendored
View File

@@ -14,4 +14,5 @@ venv/
win-cross/
!firefox-patches/
target/
.vscode/

View File

@@ -6,7 +6,7 @@
"**/*": ""
},
"scripts": {
"build": "surfer build",
"build": "npm run ffprefs && surfer build",
"build:ui": "surfer build --ui",
"start": "cd engine && ./mach run --noprofile",
"import": "surfer import",
@@ -25,7 +25,8 @@
"reset-ff": "surfer reset",
"surfer": "surfer",
"test": "python3 scripts/run_tests.py",
"test:dbg": "python3 scripts/run_tests.py --jsdebugger --debug-on-failure"
"test:dbg": "python3 scripts/run_tests.py --jsdebugger --debug-on-failure",
"ffprefs": "cd tools/ffprefs && cargo run --release --bin ffprefs -- ../../"
},
"repository": {
"type": "git",

19
prefs/ai.yaml Normal file
View File

@@ -0,0 +1,19 @@
# 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/.
# Machine learning and chat feature preferences
- name: browser.ml.chat.enabled
value: false
- name: browser.ml.chat.shortcuts
value: false
- name: browser.ml.chat.shortcuts.custom
value: false
- name: browser.ml.chat.sidebar
value: false
- name: browser.ml.enable
value: false

81
prefs/browser.yaml Normal file
View File

@@ -0,0 +1,81 @@
# 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/.
- name: browser.startup.page
value: 3
- name: browser.sessionstore.restore_pinned_tabs_on_demand
value: true
- name: browser.tabs.loadBookmarksInTabs
value: false
- name: browser.tabs.hoverPreview.enabled
value: false
- name: browser.tabs.dragdrop.moveOverThresholdPercent
value: 50
- name: browser.tabs.unloadTabInContextMenu
value: true
- name: browser.tabs.fadeOutExplicitlyUnloadedTabs
value: true
- name: browser.toolbars.bookmarks.visibility
value: 'never'
- name: browser.bookmarks.openInTabClosesMenu
value: false
- name: browser.menu.showViewImageInfo
value: true
- name: findbar.highlightAll
value: true
- name: layout.word_select.eat_space_to_next_word
value: false
- name: widget.non-native-theme.scrollbar.style
value: 2
- name: widget.non-native-theme.use-theme-accent
value: true
- name: browser.download.autohideButton
value: false
- name: sidebar.revamp
value: false
locked: true
- name: sidebar.verticalTabs
value: false
locked: true
- name: browser.preferences.experimental
value: true
- name: browser.download.manager.addToRecentDocs
value: false
- name: browser.download.open_pdf_attachments_inline
value: true
- name: browser.download.alwaysOpenPanel
value: false
- name: app.update.checkInstallTime.days
value: 6
condition: 'defined(MOZILLA_OFFICIAL)'
- name: browser.profiles.enabled
value: false
- name: browser.tabs.groups.enabled
value: false
- name: browser.urlbar.scotchBonnet.enableOverride
value: false

38
prefs/compact-mode.yaml Normal file
View File

@@ -0,0 +1,38 @@
# 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/.
- name: zen.view.compact.hide-tabbar
value: true
- name: zen.view.compact.hide-toolbar
value: false
- name: zen.view.compact.toolbar-flash-popup
value: false
- name: zen.view.compact.toolbar-flash-popup.duration
value: 800
- name: zen.view.compact.toolbar-hide-after-hover.duration
value: 1000
- name: zen.view.compact.color-toolbar
value: true
- name: zen.view.compact.color-sidebar
value: true
- name: zen.view.compact.animate-sidebar
value: true
- name: zen.view.compact.show-sidebar-and-toolbar-on-hover
value: true
- name: zen.view.compact.show-background-tab-toast
value: true
# Do not edit manually
- name: zen.view.compact.should-enable-at-startup
hidden: true
value: false

33
prefs/disablemozilla.yaml Normal file
View File

@@ -0,0 +1,33 @@
# 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/.
- name: browser.privatebrowsing.vpnpromourl
value: ''
locked: true
- name: extensions.getAddons.showPane
value: false
- name: extensions.htmlaboutaddons.recommendations.enabled
value: false
- name: browser.discovery.enabled
value: false
- name: browser.newtabpage.activity-stream.asrouter.userprefs.cfr.addons
value: false
- name: browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features
value: false
- name: browser.preferences.moreFromMozilla
value: false
locked: true
- name: browser.aboutwelcome.enabled
value: false
- name: browser.contentblocking.report.show_mobile_app
value: false
locked: true

View File

@@ -2,6 +2,8 @@
# 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/.
pref('pdfjs.enableHighlightEditor', true);
pref('pdfjs.enableHighlightFloatingButton', true);
pref("pdfjs.enableScripting", false);
- name: zen.downloads.download-animation
value: true
- name: zen.downloads.download-animation-duration
value: 1000 # ms

View File

@@ -2,5 +2,8 @@
# 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/.
pref('zen.downloads.download-animation', true);
pref('zen.downloads.download-animation-duration', 1000); // ms
- name: xpinstall.signatures.required
value: true
- name: extensions.pocket.enabled
value: false

16
prefs/fullscreen.yaml Normal file
View File

@@ -0,0 +1,16 @@
# 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/.
# Fullscreen API preferences
- name: full-screen-api.transition-duration.enter
value: '0 0'
- name: full-screen-api.transition-duration.leave
value: '0 0'
- name: full-screen-api.warning.delay
value: -1
- name: full-screen-api.warning.timeout
value: 0

18
prefs/glance.yaml Normal file
View File

@@ -0,0 +1,18 @@
# 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/.
- name: zen.glance.enabled
value: true
- name: zen.glance.enable-contextmenu-search
value: true
- name: zen.glance.hold-duration
value: 300 # in ms
- name: zen.glance.open-essential-external-links
value: true
- name: zen.glance.activation-method
value: 'alt' # ctrl, alt, shift, none, hold

21
prefs/gtk.yaml Normal file
View File

@@ -0,0 +1,21 @@
# 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/.
# GTK-specific preferences
- name: widget.gtk.rounded-bottom-corners.enabled
value: true
condition: 'defined(MOZ_WIDGET_GTK) && defined(UNIX_BUT_NOT_MAC)'
- name: zen.widget.linux.transparency
value: false
condition: 'defined(MOZ_WIDGET_GTK)'
# VAAPI/FFmpeg preferences for Linux
- name: media.ffmpeg.vaapi.enabled
value: true
condition: 'defined(MOZ_WIDGET_GTK)'
- name: media.ffmpeg.encoder.enabled
value: true
condition: 'defined(MOZ_WIDGET_GTK)'

12
prefs/kbs.yaml Normal file
View File

@@ -0,0 +1,12 @@
# 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/.
- name: zen.keyboard.shortcuts.enabled
value: true
- name: zen.keyboard.shortcuts.version
value: 0 # Empty string means default shortcuts
- name: zen.keyboard.shortcuts.disable-mainkeyset-clear
value: false # for debugging

View File

@@ -3,7 +3,10 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Enable transparent background for macos
pref('widget.macos.sidebar-blend-mode.behind-window', true);
- name: widget.macos.sidebar-blend-mode.behind-window
value: true
condition: 'defined(XP_MACOSX)'
# 1. hudWindow
# 2. fullScreenUI
# 3. popover
@@ -11,4 +14,9 @@ pref('widget.macos.sidebar-blend-mode.behind-window', true);
# 5. toolTip
# 6. headerView
# 7. underlay
pref('zen.widget.macos.window-material', 1);
- name: zen.widget.macos.window-material
value: 1
condition: 'defined(XP_MACOSX)'
cpptype: uint32_t
mirror: always
type: static

17
prefs/media.yaml Normal file
View File

@@ -0,0 +1,17 @@
# 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/.
- name: image.jxl.enabled
value: true
locked: true
- name: svg.context-properties.content.enabled
value: true
- name: image.avif.enabled
value: true
locked: true
- name: media.eme.enabled
value: true

28
prefs/mods.yaml Normal file
View File

@@ -0,0 +1,28 @@
# 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/.
- name: zen.mods.updated-value-observer
value: false
- name: zen.mods.auto-update-days
value: 20 # In days
- name: zen.mods.auto-update
value: '@cond'
condition: 'defined(MOZILLA_OFFICIAL)'
- name: zen.rice.share.notice.accepted
value: false
# === Mark: Site Injection ===
- name: zen.injections.match-urls
value: 'https://zen-browser.app/*'
locked: true
condition: 'defined(MOZILLA_OFFICIAL)'
- name: zen.injections.match-urls
value: 'http://localhost/*'
locked: true
condition: '!defined(MOZILLA_OFFICIAL)'

View File

@@ -2,6 +2,5 @@
# 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/.
pref('zen.splitView.enable-tab-drop', true);
pref('zen.splitView.min-resize-width', 7);
pref('zen.splitView.rearrange-hover-size', 24);
- name: intl.multilingual.downloadEnabled
value: false

24
prefs/newtab.yaml Normal file
View File

@@ -0,0 +1,24 @@
# 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/.
- name: browser.newtabpage.activity-stream.feeds.topsites
value: false
- name: browser.newtabpage.activity-stream.feeds.section.topstories
value: false
- name: browser.topsites.contile.enabled
value: false
- name: browser.newtabpage.activity-stream.system.showWeather
value: false
- name: browser.newtabpage.activity-stream.newtabWallpapers.enabled
value: true
- name: browser.newtabpage.activity-stream.newtabWallpapers.v2.enabled
value: true
- name: browser.translations.newSettingsUI.enable
value: true

View File

@@ -2,7 +2,11 @@
# 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/.
// security: They must enable this themselves, to avoid people downloading malware
pref('xpinstall.signatures.required', true);
pref("extensions.pocket.enabled", false);
- name: pdfjs.enableHighlightEditor
value: true
- name: pdfjs.enableHighlightFloatingButton
value: true
- name: pdfjs.enableScripting
value: false

10
prefs/performance.yaml Normal file
View File

@@ -0,0 +1,10 @@
# 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/.
- name: browser.lowMemoryResponseMask
value: 3
condition: 'defined(XP_MACOSX)'
- name: network.predictor.enable-hover-on-ssl
value: true

View File

@@ -2,6 +2,9 @@
# 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/.
pref("media.videocontrols.picture-in-picture.video-toggle.enabled", true);
- name: media.videocontrols.picture-in-picture.video-toggle.enabled
value: true
# TODO: Enable once we have a proper settings page
pref("media.videocontrols.picture-in-picture.enable-when-switching-tabs.enabled", false);
- name: media.videocontrols.picture-in-picture.enable-when-switching-tabs.enabled
value: false

121
prefs/privacy.yaml Normal file
View File

@@ -0,0 +1,121 @@
# 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/.
# Telemetry & Data Reporting
- name: datareporting.policy.dataSubmissionEnabled
value: false
locked: true
- name: datareporting.healthreport.uploadEnabled
value: false
locked: true
- name: toolkit.telemetry.unified
value: false
locked: true
- name: toolkit.telemetry.enabled
value: false
locked: true
- name: toolkit.telemetry.server
value: 'data:,'
locked: true
- name: toolkit.telemetry.archive.enabled
value: false
locked: true
- name: toolkit.telemetry.newProfilePing.enabled
value: false
locked: true
- name: toolkit.telemetry.shutdownPingSender.enabled
value: false
locked: true
- name: toolkit.telemetry.updatePing.enabled
value: false
locked: true
- name: toolkit.telemetry.bhrPing.enabled
value: false
locked: true
- name: toolkit.telemetry.firstShutdownPing.enabled
value: false
locked: true
- name: toolkit.telemetry.coverage.opt-out
value: true
locked: true
- name: toolkit.coverage.opt-out
value: true
locked: true
- name: toolkit.coverage.endpoint.base
value: ''
locked: true
- name: browser.newtabpage.activity-stream.feeds.telemetry
value: false
locked: true
- name: browser.newtabpage.activity-stream.telemetry
value: false
locked: true
- name: browser.ping-centre.telemetry
value: false
- name: browser.attribution.enabled
value: false
- name: toolkit.telemetry.pioneer-new-studies-available
value: false
- name: app.shield.optoutstudies.enabled
value: false
locked: true
- name: app.normandy.enabled
value: false
- name: app.normandy.api_url
value: ''
locked: true
# Crash Reports
- name: breakpad.reportURL
value: ''
- name: browser.tabs.crashReporting.sendReport
value: false
- name: browser.crashReports.unsubmittedCheck.autoSubmit2
value: false
# Privacy and Misc
- name: extensions.getAddons.cache.enabled
value: false
- name: browser.privatebrowsing.forceMediaMemoryCache
value: true
- name: browser.helperApps.deleteTempFileOnExit
value: true
- name: browser.uitour.enabled
value: false
- name: privacy.globalprivacycontrol.enabled
value: true
# Contextual Identities
- name: privacy.userContext.enabled
value: true
- name: privacy.userContext.ui.enabled
value: true

49
prefs/smoothscroll.yaml Normal file
View File

@@ -0,0 +1,49 @@
# 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/.
# Smooth scrolling and mousewheel tuning preferences
- name: general.smoothScroll.msdPhysics.enabled
condition: '!defined(XP_MACOSX)'
value: true
- name: general.smoothScroll.currentVelocityWeighting
condition: '!defined(XP_MACOSX)'
value: '0.15'
- name: general.smoothScroll.stopDecelerationWeighting
condition: '!defined(XP_MACOSX)'
value: '0.6'
- name: mousewheel.min_line_scroll_amount
condition: '!defined(XP_MACOSX)'
value: 10
- name: general.smoothScroll.mouseWheel.durationMinMS
condition: '!defined(XP_MACOSX)'
value: 80
- name: general.smoothScroll.msdPhysics.continuousMotionMaxDeltaMS
condition: '!defined(XP_MACOSX)'
value: 12
- name: general.smoothScroll.msdPhysics.motionBeginSpringConstant
condition: '!defined(XP_MACOSX)'
value: 600
- name: general.smoothScroll.msdPhysics.regularSpringConstant
condition: '!defined(XP_MACOSX)'
value: 650
- name: general.smoothScroll.msdPhysics.slowdownMinDeltaMS
condition: '!defined(XP_MACOSX)'
value: 25
- name: general.smoothScroll.msdPhysics.slowdownSpringConstant
condition: '!defined(XP_MACOSX)'
value: 250
- name: mousewheel.default.delta_multiplier_y
condition: '!defined(XP_MACOSX)'
value: 200

12
prefs/split-view.yaml Normal file
View File

@@ -0,0 +1,12 @@
# 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/.
- name: zen.splitView.enable-tab-drop
value: true
- name: zen.splitView.min-resize-width
value: 7
- name: zen.splitView.rearrange-hover-size
value: 24

16
prefs/static.yaml Normal file
View File

@@ -0,0 +1,16 @@
# 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/.
- name: zen.haptic-feedback.enabled
cpptype: bool
value: true
mirror: always
type: static
- name: zen.swipe.is-fast-swipe
cpptype: bool
value: true
mirror: always
hidden: true
type: static

39
prefs/theme.yaml Normal file
View File

@@ -0,0 +1,39 @@
# 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/.
- name: zen.theme.accent-color
value: '#ffb787'
- name: zen.theme.content-element-separation
value: 8
- name: zen.theme.gradient
value: true
- name: zen.theme.gradient.show-custom-colors
value: false
- name: zen.theme.essentials-favicon-bg
value: true
- name: zen.theme.acrylic-elements
value: false
- name: zen.theme.disable-lightweight
value: true
- name: zen.theme.use-sysyem-colors
value: false
# ==== Mark: border radius ====
# macOS border radius
- name: zen.theme.border-radius
value: 10
condition: 'defined(XP_MACOSX)'
# non-macOS border radius
- name: zen.theme.border-radius
value: 8
condition: '!defined(XP_MACOSX)'

80
prefs/urlbar.yaml Normal file
View File

@@ -0,0 +1,80 @@
# 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/.
# URL bar and search-related preferences
- name: browser.urlbar.unitConversion.enabled
value: true
- name: browser.urlbar.trending.featureGate
value: false
- name: browser.urlbar.weather.featureGate
value: false
- name: browser.urlbar.quickactions.enabled
value: true
- name: browser.urlbar.clipboard.featureGate
value: true
- name: browser.urlbar.suggest.calculator
value: true
- name: browser.urlbar.trimHttps
value: true
- name: browser.urlbar.untrimOnUserInteraction.featureGate
value: true
# Keep in sync with browser/components/topsites/constants.mjs
- name: browser.urlbar.maxRichResults
value: 7
# Enable private suggestions
- name: browser.search.suggest.enabled
value: false
- name: browser.search.suggest.enabled.private
value: false
- name: browser.search.separatePrivateDefault.ui.enabled
value: true
- name: browser.urlbar.update2.engineAliasRefresh
value: true
- name: browser.urlbar.quicksuggest.enabled
value: false
locked: true
- name: browser.urlbar.suggest.quicksuggest.sponsored
value: false
locked: true
- name: browser.urlbar.suggest.quicksuggest.nonsponsored
value: false
locked: true
- name: browser.urlbar.groupLabels.enabled
value: false
- name: browser.urlbar.keepPanelOpenDuringImeComposition
value: true # IMPORTANT: Fixes closing the urlbar when on some languages
- name: browser.formfill.enable
value: false
- name: security.insecure_connection_text.enabled
value: true
- name: security.insecure_connection_text.pbmode.enabled
value: true
- name: network.IDN_show_punycode
value: true
- name: browser.urlbar.suggest.topsites
value: true
locked: true

47
prefs/view.yaml Normal file
View File

@@ -0,0 +1,47 @@
# 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/.
- name: zen.view.sidebar-height-throttle
value: 0
- name: zen.view.sidebar-expanded.max-width
value: 500
- name: zen.view.mac.show-three-dot-menu
value: false
condition: 'defined(XP_MACOSX)'
- name: zen.widget.mac.mono-window-controls
value: true
condition: 'defined(XP_MACOSX)'
- name: zen.view.use-single-toolbar
value: true
- name: zen.view.sidebar-expanded
value: true
- name: zen.view.sidebar-collapsed.hide-mute-button
value: true
- name: zen.view.experimental-force-window-controls-left
value: false
- name: zen.view.hide-window-controls
value: true
- name: zen.view.experimental-no-window-controls
value: false
- name: zen.view.grey-out-inactive-windows
value: true
- name: zen.view.show-newtab-button-border-top
value: false
- name: zen.view.show-newtab-button-top
value: true
- name: zen.view.window.scheme
value: 2

8
prefs/watermark.yaml Normal file
View File

@@ -0,0 +1,8 @@
# 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/.
- name: zen.watermark.enabled
value: '@cond'
sticky: true
condition: 'defined(MOZILLA_OFFICIAL)'

8
prefs/welcome.yaml Normal file
View File

@@ -0,0 +1,8 @@
# 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/.
- name: zen.welcome-screen.seen
value: '@cond'
sticky: true
condition: '!defined(MOZILLA_OFFICIAL)'

19
prefs/windows.yaml Normal file
View File

@@ -0,0 +1,19 @@
# 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/.
# Mica effect preferences for Windows
- name: widget.windows.mica
value: true
condition: 'defined(XP_WIN)'
- name: widget.windows.mica.popups
value: true
condition: 'defined(XP_WIN)'
# 1 = DWMSBT_MAINWINDOW
# 2 = DWMSBT_TRANSIENTWINDOW (default, also used for popups)
# 3 = DWMSBT_TABBEDWINDOW
- name: widget.windows.mica.toplevel-backdrop
value: 2
condition: 'defined(XP_WIN)'

46
prefs/workspaces.yaml Normal file
View File

@@ -0,0 +1,46 @@
# 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/.
- name: zen.workspaces.continue-where-left-off
value: false
- name: zen.workspaces.hide-default-container-indicator
value: true
- name: zen.workspaces.force-container-workspace
value: false
- name: zen.workspaces.open-new-tab-if-last-unpinned-tab-is-closed
value: false
- name: zen.workspaces.swipe-actions
value: true
- name: zen.workspaces.wrap-around-navigation
value: true
- name: zen.workspaces.natural-scroll
value: false
- name: zen.workspaces.scroll-modifier-key
value: ctrl
- name: services.sync.engine.workspaces
value: false
- name: zen.workspaces.separate-essentials
value: true
- name: zen.workspaces.debug
value: '@cond'
condition: '!defined(MOZILLA_OFFICIAL)' # Section: Pinned tabs management
- name: zen.pinned-tab-manager.debug
value: false
- name: zen.pinned-tab-manager.restore-pinned-tabs-to-pinned-url
value: false
- name: zen.pinned-tab-manager.close-shortcut-behavior
value: reset-unload-switch

24
prefs/zen-urlbar.yaml Normal file
View File

@@ -0,0 +1,24 @@
# 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/.
- name: zen.urlbar.replace-newtab
value: true
- name: zen.urlbar.show-protections-icon
value: false
- name: zen.urlbar.behavior
value: floating-on-type
- name: zen.urlbar.wait-to-clear
value: 45000
- name: zen.urlbar.show-domain-only-in-sidebar
value: true
- name: zen.urlbar.hide-one-offs
value: true
- name: zen.urlbar.enable-overrides
value: false

27
prefs/zen.yaml Normal file
View File

@@ -0,0 +1,27 @@
# 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/.
- name: zen.tabs.vertical
value: true
- name: zen.tabs.vertical.right-side
value: false
- name: zen.tabs.rename-tabs
value: true
- name: zen.tabs.show-newtab-vertical
value: true
- name: zen.ctrlTab.show-pending-tabs
value: false
- name: zen.mediacontrols.enabled
value: true
- name: zen.haptic-feedback.enabled
value: true
- name: zen.startup.smooth-scroll-in-tabs
value: true

View File

@@ -1,9 +0,0 @@
# 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/.
pref("browser.ml.chat.enabled", false);
pref("browser.ml.chat.shortcuts", false);
pref("browser.ml.chat.shortcuts.custom", false);
pref("browser.ml.chat.sidebar", false);
pref("browser.ml.enable", false);

View File

@@ -1,55 +0,0 @@
# 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/.
// Restore session on startup
pref("browser.startup.page", 3);
pref("browser.sessionstore.restore_pinned_tabs_on_demand", true);
// Toolbars
pref("browser.tabs.loadBookmarksInTabs", false);
pref("browser.tabs.hoverPreview.enabled", false);
pref("browser.tabs.dragdrop.moveOverThresholdPercent", 50);
pref("browser.tabs.unloadTabInContextMenu", true);
pref("browser.tabs.fadeOutExplicitlyUnloadedTabs", true);
pref('browser.toolbars.bookmarks.visibility', 'never');
pref("browser.bookmarks.openInTabClosesMenu", false);
pref("browser.menu.showViewImageInfo", true);
pref("findbar.highlightAll", true);
pref("layout.word_select.eat_space_to_next_word", false);
// Better Windows theming
pref("widget.non-native-theme.scrollbar.style", 2);
pref("widget.non-native-theme.use-theme-accent", true);
// for the new layout:
pref('browser.download.autohideButton', false);
// Disable Firefox's revamp
pref("sidebar.revamp", false, locked);
pref("sidebar.verticalTabs", false, locked);
// Enable experimental settings page (Used for Zen Labs)
pref('browser.preferences.experimental', true);
// Downloads
pref("browser.download.manager.addToRecentDocs", false);
pref('browser.download.open_pdf_attachments_inline', true);
pref('browser.download.alwaysOpenPanel', false);
// Updates
#ifdef MOZILLA_OFFICIAL
pref("app.update.checkInstallTime.days", 6);
#endif
#include fullscreen.inc
#include ai.inc
#include disablemozilla.inc
// TODO: Check this out!
pref("browser.profiles.enabled", false);
pref("browser.tabs.groups.enabled", false);
pref("browser.urlbar.scotchBonnet.enableOverride", false);

View File

@@ -1,14 +0,0 @@
# 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/.
// Common UI changes
pref("browser.privatebrowsing.vpnpromourl", "", locked);
pref("extensions.getAddons.showPane", false);
pref("extensions.htmlaboutaddons.recommendations.enabled", false);
pref("browser.discovery.enabled", false);
pref("browser.newtabpage.activity-stream.asrouter.userprefs.cfr.addons", false);
pref("browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features", false);
pref("browser.preferences.moreFromMozilla", false, locked);
pref("browser.aboutwelcome.enabled", false);
pref("browser.contentblocking.report.show_mobile_app", false, locked);

View File

@@ -1,41 +0,0 @@
# 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/.
#ifdef MOZILLA_OFFICIAL
pref('zen.welcome-screen.seen', false, sticky);
#else
pref('zen.welcome-screen.seen', true, sticky);
#endif
pref('zen.tabs.vertical', true);
pref('zen.tabs.vertical.right-side', false);
pref('zen.tabs.rename-tabs', true);
pref('zen.tabs.show-newtab-vertical', true);
pref('zen.ctrlTab.show-pending-tabs', false);
pref('zen.mediacontrols.enabled', true);
pref('zen.haptic-feedback.enabled', true);
#include features/mods.inc
#include features/theme.inc
#include features/compact-mode.inc
#include features/urlbar.inc
#include features/glance.inc
#include features/view.inc
#include features/downloads.inc
#include features/workspaces.inc
#include features/split-view.inc
#include features/kbs.inc
// Section: Watermark
#ifdef MOZILLA_OFFICIAL
pref('zen.watermark.enabled', true, sticky);
#else
pref('zen.watermark.enabled', false, sticky);
#endif
// Startup flags
pref('zen.startup.smooth-scroll-in-tabs', true);

View File

@@ -1,17 +0,0 @@
# 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/.
pref('zen.view.compact.hide-tabbar', true);
pref('zen.view.compact.hide-toolbar', false);
pref('zen.view.compact.toolbar-flash-popup', false);
pref('zen.view.compact.toolbar-flash-popup.duration', 800);
pref('zen.view.compact.toolbar-hide-after-hover.duration', 1000);
pref('zen.view.compact.color-toolbar', true);
pref('zen.view.compact.color-sidebar', true);
pref('zen.view.compact.animate-sidebar', true);
pref('zen.view.compact.show-sidebar-and-toolbar-on-hover', true);
pref('zen.view.compact.show-background-tab-toast', true);
# Do not edit manually
pref('zen.view.compact.should-enable-at-startup', false);

View File

@@ -1,9 +0,0 @@
# 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/.
pref('zen.glance.enabled', true);
pref('zen.glance.enable-contextmenu-search', true);
pref('zen.glance.hold-duration', 300); // in ms
pref('zen.glance.open-essential-external-links', true);
pref('zen.glance.activation-method', 'alt'); // ctrl, alt, shift, none, hold

View File

@@ -1,7 +0,0 @@
# 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/.
pref('zen.keyboard.shortcuts.enabled', true);
pref('zen.keyboard.shortcuts.version', 0); // Empty string means default shortcuts
pref('zen.keyboard.shortcuts.disable-mainkeyset-clear', false); // for debugging

View File

@@ -1,17 +0,0 @@
# 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/.
pref('zen.mods.updated-value-observer', false);
pref('zen.mods.auto-update-days', 20); // In days
#ifdef MOZILLA_OFFICIAL
pref('zen.mods.auto-update', true);
pref('zen.injections.match-urls', 'https://zen-browser.app/*', locked);
#else
pref('zen.mods.auto-update', false);
pref('zen.injections.match-urls', 'http://localhost/*', locked);
#endif
pref('zen.rice.share.notice.accepted', false);

View File

@@ -1,25 +0,0 @@
# 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/.
pref('zen.theme.accent-color', "#ffb787");
pref('zen.theme.content-element-separation', 8); // In pixels
pref('zen.theme.gradient', true);
pref('zen.theme.gradient.show-custom-colors', false);
pref('zen.theme.essentials-favicon-bg', true);
#ifdef XP_MACOSX
pref('zen.theme.border-radius', 10); // In pixels
#else
pref('zen.theme.border-radius', 8); // In pixels
#endif
#ifdef XP_MACOSX
pref('zen.theme.acrylic-elements', false);
#else
pref('zen.theme.acrylic-elements', false);
#endif
# Light weight themes
pref('zen.theme.disable-lightweight', true);
pref('zen.theme.use-sysyem-colors', false);

View File

@@ -1,11 +0,0 @@
# 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/.
pref('zen.urlbar.replace-newtab', true);
pref('zen.urlbar.show-protections-icon', false);
pref('zen.urlbar.behavior', 'floating-on-type'); // default, floating-on-type, float
pref('zen.urlbar.wait-to-clear', 45000); // in ms (default 45s)
pref('zen.urlbar.show-domain-only-in-sidebar', true);
pref('zen.urlbar.hide-one-offs', true);
pref('zen.urlbar.enable-overrides', false);

View File

@@ -1,29 +0,0 @@
# 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/.
pref('zen.view.sidebar-height-throttle', 0); // in ms
pref('zen.view.sidebar-expanded.max-width', 500);
#ifdef XP_MACOSX
pref('zen.view.mac.show-three-dot-menu', false);
pref('zen.widget.mac.mono-window-controls', true);
#endif
pref('zen.view.use-single-toolbar', true);
pref('zen.view.sidebar-expanded', true);
pref('zen.view.sidebar-collapsed.hide-mute-button', true);
pref('zen.view.experimental-force-window-controls-left', false);
pref('zen.view.hide-window-controls', true);
pref('zen.view.experimental-no-window-controls', false);
pref('zen.view.grey-out-inactive-windows', true);
pref('zen.view.show-newtab-button-border-top', false);
pref('zen.view.show-newtab-button-top', true);
# 0: Dark
# 1: Light
# 2: Auto (system color scheme unless overridden by browser theme)
pref('zen.view.window.scheme', 2); // auto, light, dark

View File

@@ -1,25 +0,0 @@
# 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/.
pref('zen.workspaces.continue-where-left-off', false);
pref('zen.workspaces.hide-default-container-indicator', true);
pref('zen.workspaces.force-container-workspace', false);
pref('zen.workspaces.open-new-tab-if-last-unpinned-tab-is-closed', false);
pref('zen.workspaces.swipe-actions', true);
pref('zen.workspaces.wrap-around-navigation', true);
pref('zen.workspaces.natural-scroll', false);
pref('zen.workspaces.scroll-modifier-key','ctrl'); // can be ctrl, alt, shift, or a meta key
pref('services.sync.engine.workspaces', false);
pref('zen.workspaces.separate-essentials', true);
#ifdef MOZILLA_OFFICIAL
pref('zen.workspaces.debug', false);
#else
pref('zen.workspaces.debug', true);
#endif
# Section: Pinned tabs management
pref('zen.pinned-tab-manager.debug', false);
pref('zen.pinned-tab-manager.restore-pinned-tabs-to-pinned-url', false);
pref('zen.pinned-tab-manager.close-shortcut-behavior', 'reset-unload-switch');

View File

@@ -1,10 +0,0 @@
diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js
index 4050c0090e7fa9e0b3121194f47c7d29d4c394ab..138a17f5907540edbf39867a2ef9e63148e3ffa6 100644
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -3397,3 +3397,5 @@ pref("browser.contextual-services.contextId.rust-component.enabled", true);
// Pref to enable the IP protection feature
pref("browser.ipProtection.enabled", false);
+
+#include zen-browser.js

View File

@@ -1,8 +0,0 @@
# 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/.
pref("full-screen-api.transition-duration.enter", "0 0");
pref("full-screen-api.transition-duration.leave", "0 0");
pref("full-screen-api.warning.delay", -1);
pref("full-screen-api.warning.timeout", 0);

View File

@@ -1,14 +0,0 @@
# 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/.
pref("widget.gtk.rounded-bottom-corners.enabled", true);
// Enable transparent background for linux
#ifdef MOZ_WIDGET_GTK
pref('zen.widget.linux.transparency', false);
// VAAPI/FFMPEG is Linux only
pref('media.ffmpeg.vaapi.enabled', true);
pref('media.ffmpeg.encoder.enabled', true);
#endif

View File

@@ -1,9 +0,0 @@
# 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/.
pref('image.jxl.enabled', true, locked);
pref("svg.context-properties.content.enabled", true);
pref("image.avif.enabled", true, locked);
pref("media.eme.enabled", true);

View File

@@ -1,12 +0,0 @@
# 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/.
pref('browser.newtabpage.activity-stream.feeds.topsites', false);
pref('browser.newtabpage.activity-stream.feeds.section.topstories', false);
pref("browser.topsites.contile.enabled", false);
pref('browser.newtabpage.activity-stream.system.showWeather', false);
pref('browser.newtabpage.activity-stream.newtabWallpapers.enabled', true);
pref('browser.newtabpage.activity-stream.newtabWallpapers.v2.enabled', true);
pref('browser.translations.newSettingsUI.enable', true);

View File

@@ -1,18 +0,0 @@
# 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/.
#ifdef XP_MACOSX
# Pref to control the reponse taken on macOS when the OS is under memory
# pressure. Changes to the pref take effect immediately. Browser restart not
# required. The pref value is a bitmask:
# 0x0: No response (other than recording for telemetry, crash reporting)
# 0x1: Use the tab unloading feature to reduce memory use. Requires that
# the above "browser.tabs.unloadOnLowMemory" pref be set to true for tab
# unloading to occur.
# 0x2: Issue the internal "memory-pressure" notification to reduce memory use
# 0x3: Both 0x1 and 0x2.
pref("browser.lowMemoryResponseMask", 3);
#endif
pref("network.predictor.enable-hover-on-ssl", true);

View File

@@ -1,47 +0,0 @@
# 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/.
pref("datareporting.policy.dataSubmissionEnabled", false, locked);
pref("datareporting.healthreport.uploadEnabled", false, locked);
pref("toolkit.telemetry.unified", false, locked);
pref("toolkit.telemetry.enabled", false, locked);
pref("toolkit.telemetry.server", "data:,", locked);
pref("toolkit.telemetry.archive.enabled", false, locked);
pref("toolkit.telemetry.newProfilePing.enabled", false, locked);
pref("toolkit.telemetry.shutdownPingSender.enabled", false, locked);
pref("toolkit.telemetry.updatePing.enabled", false, locked);
pref("toolkit.telemetry.bhrPing.enabled", false, locked);
pref("toolkit.telemetry.firstShutdownPing.enabled", false, locked);
pref("toolkit.telemetry.coverage.opt-out", true, locked);
pref("toolkit.coverage.opt-out", true, locked);
pref("toolkit.coverage.endpoint.base", "", locked);
pref("browser.newtabpage.activity-stream.feeds.telemetry", false, locked);
pref("browser.newtabpage.activity-stream.telemetry", false, locked);
pref("browser.ping-centre.telemetry", false);
pref("browser.attribution.enabled", false);
pref("toolkit.telemetry.pioneer-new-studies-available", false);
pref("app.shield.optoutstudies.enabled", false, locked);
pref("app.normandy.enabled", false);
pref("app.normandy.api_url", "", locked);
# Crash reports
pref("breakpad.reportURL", "");
pref("browser.tabs.crashReporting.sendReport", false);
pref("browser.crashReports.unsubmittedCheck.autoSubmit2", false);
# Other privacy
pref("extensions.getAddons.cache.enabled", false);
# Disable cache for private browsing
pref("browser.privatebrowsing.forceMediaMemoryCache", true);
# Tracking protection
pref("browser.helperApps.deleteTempFileOnExit", true);
pref("browser.uitour.enabled", false);
pref("privacy.globalprivacycontrol.enabled", true);
# Contextual identity
pref('privacy.userContext.enabled', true);
pref('privacy.userContext.ui.enabled', true);

View File

@@ -1,15 +0,0 @@
# 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/.
pref("general.smoothScroll.msdPhysics.enabled", true);
pref("general.smoothScroll.currentVelocityWeighting", "0.15");
pref("general.smoothScroll.stopDecelerationWeighting", "0.6");
pref("mousewheel.min_line_scroll_amount", 10);
pref("general.smoothScroll.mouseWheel.durationMinMS", 80);
pref("general.smoothScroll.msdPhysics.continuousMotionMaxDeltaMS", 12);
pref("general.smoothScroll.msdPhysics.motionBeginSpringConstant", 600);
pref("general.smoothScroll.msdPhysics.regularSpringConstant", 650);
pref("general.smoothScroll.msdPhysics.slowdownMinDeltaMS", 25);
pref("general.smoothScroll.msdPhysics.slowdownSpringConstant", 250);
pref("mousewheel.default.delta_multiplier_y", 200);

View File

@@ -1,35 +0,0 @@
# 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/.
pref('browser.urlbar.unitConversion.enabled', true);
pref('browser.urlbar.trending.featureGate', false);
pref('browser.urlbar.weather.featureGate', false);
pref('browser.urlbar.quickactions.enabled', true);
pref('browser.urlbar.clipboard.featureGate', true);
pref('browser.urlbar.suggest.calculator', true);
pref("browser.urlbar.trimHttps", true);
pref("browser.urlbar.untrimOnUserInteraction.featureGate", true);
# Keep in sync with browser/components/topsites/constants.mjs
pref("browser.urlbar.maxRichResults", 7);
# Enable private suggestions
pref('browser.search.suggest.enabled', false);
pref('browser.search.suggest.enabled.private', false);
pref("browser.urlbar.trimHttps", true);
pref("browser.search.separatePrivateDefault.ui.enabled", true);
pref("browser.urlbar.update2.engineAliasRefresh", true);
pref("browser.urlbar.quicksuggest.enabled", false, locked);
pref("browser.urlbar.suggest.quicksuggest.sponsored", false, locked);
pref("browser.urlbar.suggest.quicksuggest.nonsponsored", false, locked);
pref("browser.urlbar.groupLabels.enabled", false);
pref("browser.urlbar.keepPanelOpenDuringImeComposition", true); // IMPORTANT: Fixes closing the urlbar when on some languages
pref("browser.formfill.enable", false);
pref("security.insecure_connection_text.enabled", true);
pref("security.insecure_connection_text.pbmode.enabled", true);
pref("network.IDN_show_punycode", true);
pref("browser.urlbar.suggest.topsites", true, locked);

View File

@@ -1,12 +0,0 @@
# 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/.
# Mica
pref("widget.windows.mica", true);
pref("widget.windows.mica.popups", true);
# 1. DWMSBT_MAINWINDOW
# 2. DWMSBT_TRANSIENTWINDOW (default, also used for popups)
# 3(default). DWMSBT_TABBEDWINDOW
pref("widget.windows.mica.toplevel-backdrop", 2);

View File

@@ -1,41 +0,0 @@
# 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/.
#ifdef XP_UNIX
#ifndef XP_MACOSX
#define UNIX_BUT_NOT_MAC
#endif
#endif
# Dont download the multilingual dictionary
pref("intl.multilingual.downloadEnabled", false);
#ifdef XP_WIN
#include windows.inc
#endif
#ifdef UNIX_BUT_NOT_MAC
#include linux.inc
#endif
#ifdef XP_MACOSX
#include macos.inc
#endif
#include urlbar.inc
#include newtab.inc
#include pdf.inc
#include extensions.inc
#include privacy.inc
#include media.inc
#include browser.inc
#include features.inc
#ifndef XP_MACOSX
#include smoothscroll.inc
#endif
#include performance.inc
#include pip.inc

View File

@@ -1,23 +1,20 @@
# Dummy pref to always generate StaticPrefs_zen.h in every OS
- name: zen.browser.is-cool
type: bool
value: true
mirror: never
#ifdef XP_MACOSX
- name: zen.widget.macos.window-material
type: uint32_t
value: 1
mirror: always
#endif
- name: zen.haptic-feedback.enabled
type: bool
value: true
mirror: always
rust: false
- name: zen.swipe.is-fast-swipe
type: bool
value: true
mirror: always
rust: false
#if defined(XP_MACOSX)
- name: zen.widget.macos.window-material
type: uint32_t
value: 1
mirror: always
rust: false
#endif

119
tools/ffprefs/Cargo.lock generated Normal file
View File

@@ -0,0 +1,119 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "equivalent"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
[[package]]
name = "ffprefs"
version = "0.1.0"
dependencies = [
"serde",
"serde_yaml",
]
[[package]]
name = "hashbrown"
version = "0.15.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5"
[[package]]
name = "indexmap"
version = "2.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661"
dependencies = [
"equivalent",
"hashbrown",
]
[[package]]
name = "itoa"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
[[package]]
name = "proc-macro2"
version = "1.0.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
dependencies = [
"proc-macro2",
]
[[package]]
name = "ryu"
version = "1.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
[[package]]
name = "serde"
version = "1.0.219"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.219"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "serde_yaml"
version = "0.9.34+deprecated"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47"
dependencies = [
"indexmap",
"itoa",
"ryu",
"serde",
"unsafe-libyaml",
]
[[package]]
name = "syn"
version = "2.0.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "unicode-ident"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
[[package]]
name = "unsafe-libyaml"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861"

8
tools/ffprefs/Cargo.toml Normal file
View File

@@ -0,0 +1,8 @@
[package]
name = "ffprefs"
version = "0.1.0"
edition = "2021"
[dependencies]
serde = { version = "1.0.104", features = ["derive"] }
serde_yaml = "0.9.34"

315
tools/ffprefs/src/main.rs Normal file
View File

@@ -0,0 +1,315 @@
// 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/.
// Basics
// ------
// Any pref defined in one of the files included here should *not* be defined
// in a data file such as all.js; that would just be useless duplication.
//
// (Except under unusual circumstances where the value defined here must be
// overridden, e.g. for some Thunderbird prefs. In those cases the default
// value from the data file will override the static default value defined
// here.)
//
// Please follow the existing prefs naming convention when considering adding a
// new pref, and don't create a new pref group unless it's appropriate and there
// are likely to be multiple prefs within that group. (If you do, you'll need to
// update the `pref_groups` variable in modules/libpref/moz.build.)
//
// Definitions
// -----------
// A pref definition looks like this:
//
// - name: <pref-name> // mandatory
// cpptype: <cpp-type> // mandatory if static
// value: <default-value> // mandatory
// mirror: <never | once | always> // mandatory if static
// lang: <static | rust | dynamic> // optional
// condition: <condition> // optional
// locked: <true | false>. // optional only on dynamic prefs
// sticky: <true | false> // optional only on dynamic prefs
//
// - `name` is the name of the pref, without double-quotes, as it appears
// in about:config. It is used in most libpref API functions (from both C++
// and JS code).
//
// - `cpptype` is one of `bool`, `int32_t`, `uint32_t`, `float`, an atomic version
// of one of those, `String` or `DataMutexString`. Note that float prefs are
// stored internally as strings. The C++ preprocessor doesn't like template
// syntax in a macro argument, so use the typedefs defined in
// StaticPrefsBase.h; for example, use `RelaxedAtomicBool` instead of
// `Atomic<bool, Relaxed>`.
//
// - `value` is the default value. Its type should be appropriate for
// <cpp-type>, otherwise the generated code will fail to compile. A complex
// C++ numeric expressions like `60 * 60` (which the YAML parser cannot treat
// as an integer or float) is treated as a string and passed through without
// change, which is useful.
//
// - `mirror` indicates how the pref value is mirrored into a C++ variable.
//
// * `never`: There is no C++ mirror variable. The pref value can only be
// accessed via the standard libpref API functions.
//
// * `once`: The pref value is mirrored into a variable at startup; the
// mirror variable is left unchanged after that. (The exact point at which
// all `once` mirror variables are set is when the first `once` mirror
// variable is accessed, via its getter function.) This is mostly useful for
// graphics prefs where we often don't want a new pref value to apply until
// restart. Otherwise, this update policy is best avoided because its
// behaviour can cause confusion and bugs.
//
// * `always`: The mirror variable is always kept in sync with the pref value.
// This is the most common choice.
//
// When a mirror variable is present, a getter will be created that can access
// it. Using the getter function to read the pref's value has the two
// following advantages over the normal API functions.
//
// * A direct variable access is faster than a hash table lookup.
//
// * A mirror variable can be accessed off the main thread. If a pref *is*
// accessed off the main thread, it should have an atomic type. Assertions
// enforce this.
//
// Note that Rust code must access the mirror variable directly, rather than
// via the getter function.
//
// - `lang=rust` indicates if the mirror variable is used by Rust code. If so, it
// will be usable via the `static_prefs::pref!` macro, e.g.
// `static_prefs::pref!("layout.css.cross-fade.enabled")`.
//
// - `condition` is an optional condition that must be true for the pref to be
// defined. It is a C++ expression that can use any global variable or macro
// defined in the C++ code, such as `MOZ_WIDGET_GTK` or `XP_MACOS`.
//
// example: condition: "defined(XP_MACOS) || defined(MOZ_WIDGET_GTK)"
//
// - `locked` is an optional boolean that indicates whether the pref is locked
// (i.e., cannot be changed by the user). If set to `true`, the pref will
// be locked in the generated code, and the user will not be able
// to change it in about:config.
//
// The getter function's base name is the same as the pref's name, but with
// '.' or '-' chars converted to '_', to make a valid identifier. For example,
// the getter for `foo.bar_baz` is `foo_bar_baz()`. This is ugly but clear,
// and you can search for both the pref name and the getter using the regexp
// /foo.bar.baz/. Suffixes are added as follows:
//
// - If the `mirror` value is `once`, `_AtStartup` is appended, to indicate the
// value was obtained at startup.
//
use serde::{Deserialize, Serialize};
use std::env;
use std::fs;
use std::path::PathBuf;
const STATIC_PREFS: &str = "../engine/modules/libpref/init/zen-static-prefs.inc";
const FIREFOX_PREFS: &str = "../engine/browser/app/profile/firefox.js";
const DYNAMIC_PREFS: &str = "../engine/browser/app/profile/zen-browser.js";
#[derive(Serialize, Deserialize, PartialEq, Debug)]
struct Preference {
name: String,
value: String,
r#type: Option<String>,
condition: Option<String>,
hidden: Option<bool>,
cpptype: Option<String>,
mirror: Option<String>,
locked: Option<bool>,
sticky: Option<bool>,
}
fn get_config_path() -> PathBuf {
let mut path = env::current_dir().expect("Failed to get current directory");
path.push("prefs");
path
}
fn ordered_prefs(mut prefs: Vec<Preference>) -> Vec<Preference> {
// Sort preferences by name
prefs.sort_by(|a, b| a.name.cmp(&b.name));
prefs
}
fn load_preferences() -> Vec<Preference> {
let mut prefs = Vec::new();
let config_path = get_config_path();
// Iterate each file in the prefs directory
if let Ok(entries) = fs::read_dir(&config_path) {
for entry in entries {
if let Ok(entry) = entry {
if let Some(ext) = entry.path().extension() {
if ext == "yaml" || ext == "yml" {
let file_path = entry.path();
let content = fs::read_to_string(&file_path).expect("Failed to read file");
let mut parsed_prefs: Vec<Preference> =
serde_yaml::from_str(&content).expect("Failed to parse YAML");
prefs.append(&mut parsed_prefs);
}
}
}
}
}
ordered_prefs(prefs)
}
fn get_condition_string(condition: &Option<String>) -> String {
condition
.as_deref()
.map_or_else(String::new, |cond| cond.trim().to_string())
}
fn get_pref_with_condition(content: &str, condition: &str) -> String {
if condition.is_empty() {
return format!("\n{}", content);
}
format!("\n#if {}\n{}#endif", condition, content)
}
fn get_static_pref(pref: &Preference) -> String {
// - name: <pref-name> # mandatory
// type: <cpp-type> # mandatory
// value: <default-value> # mandatory
// mirror: <never | once | always> # mandatory
// do_not_use_directly: <true | false> # optional
// include: <header-file> # optional
// rust: <true | false> # optional
// set_spidermonkey_pref: <false | startup | always> # optional
// We do not hide preferences in static prefs, so we ignore the `hidden` field.
let name = format!("- name: {}\n", pref.name);
let cpp_type = format!(
" type: {}\n",
pref.cpptype
.as_deref()
.expect("cpp type is mandatory on static prefs")
);
let value = format!(" value: {}\n", pref.value);
let rust = if pref.r#type.as_deref() == Some("rust") {
" rust: true\n".to_string()
} else {
" rust: false\n".to_string()
};
let mirror = format!(
" mirror: {}\n",
pref.mirror
.as_deref()
.expect("mirror is mandatory on static prefs")
);
let content = format!("{}{}{}{}{}", name, cpp_type, value, mirror, rust);
get_pref_with_condition(&content, &get_condition_string(&pref.condition))
}
fn get_dynamic_pref(pref: &Preference) -> String {
let value = get_value(pref);
if pref.hidden.unwrap_or(false) {
return format!("# Hidden preference: {} = {}", pref.name, value);
}
let third_arg;
let is_locked = pref.locked.unwrap_or(false);
let is_sticky = pref.sticky.unwrap_or(false);
if is_locked && is_sticky {
panic!("A dynamic pref cannot be both locked and sticky");
} else if is_locked {
third_arg = ", locked".to_string();
} else if is_sticky {
third_arg = ", sticky".to_string();
} else {
third_arg = String::new();
}
// note: Dont use "value" here, as it adds quotes around the value
if pref.value == "@cond" {
// If the value is "@cond", we assume it is a placeholder for a condition
// that will be replaced later, so we do not include it in the pref definition.
return get_pref_with_condition(
&format!(
"pref(\"{}\", true);\n#else\npref(\"{}\", false);\n",
pref.name, pref.name
),
&get_condition_string(&pref.condition),
);
}
get_pref_with_condition(
&format!("pref(\"{}\", {}{});\n", pref.name, value, third_arg),
&get_condition_string(&pref.condition),
)
}
fn get_value(pref: &Preference) -> String {
// Strings must be wrapped inside double quotes
let value = &pref.value;
// Other values such as numbers or booleans can be used directly
// If the value is empty or there are any characters that could be misinterpreted,
// we should wrap it in double quotes.
let letters_inside_value =
value.chars().any(|c| c.is_alphabetic()) && value != "true" && value != "false";
if value.is_empty() || value.contains([' ', '\n', '\t', '"']) || letters_inside_value {
format!("\"{}\"", value.replace('"', "\\\""))
} else {
value.to_string()
}
}
fn write_preferences(prefs: &[Preference]) {
let config_path = get_config_path();
if !config_path.exists() {
fs::create_dir_all(&config_path).expect("Failed to create prefs directory");
}
let static_prefs_path = config_path.join(STATIC_PREFS);
let dynamic_prefs_path = config_path.join(DYNAMIC_PREFS);
println!(
"Writing preferences to:\n Static: {}\n Dynamic: {}",
static_prefs_path.display(),
dynamic_prefs_path.display()
);
let mut static_content = String::new();
let mut dynamic_content = String::new();
for pref in prefs {
let ty = pref.r#type.as_deref().unwrap_or("");
if ty == "static" || ty == "rust" {
let content = get_static_pref(pref);
static_content.push_str(&content);
}
let content = get_dynamic_pref(pref);
dynamic_content.push_str(&content);
}
fs::write(&static_prefs_path, static_content).expect("Failed to write static prefs");
fs::write(&dynamic_prefs_path, dynamic_content).expect("Failed to write dynamic prefs");
}
fn prepare_zen_prefs() {
// Add `#include zen-browser.js` to the bottom of the firefox.js file if it doesn't exist
let line = "#include zen-browser.js";
let firefox_prefs_path = get_config_path().join(FIREFOX_PREFS);
if let Ok(mut content) = fs::read_to_string(&firefox_prefs_path) {
if !content.contains(line) {
content.push_str(format!("\n{}\n", line).as_str());
// Ensure the file ends with a newline
fs::write(&firefox_prefs_path, content).expect("Failed to write firefox prefs");
}
} else {
eprintln!(
"Warning: {} does not exist or cannot be read.",
firefox_prefs_path.display()
);
}
}
fn main() {
let args: Vec<String> = env::args().collect();
let root_path = if args.len() > 1 {
PathBuf::from(&args[1])
} else {
env::current_dir().expect("Failed to get current directory")
};
env::set_current_dir(&root_path).expect("Failed to change directory");
prepare_zen_prefs();
let preferences = load_preferences();
write_preferences(&preferences);
}