Repository navigation
Add LibreWolf as supported browser - #13309
TheBananaPancake wants to merge 1 commit into
Conversation
Automated AI review
Verified: the LibreWolf plumbing is correct at The policy step overwrites LibreWolf's own
|
8c347d8 to
f2d4b9f
Compare
Automated AI review
Outcome: At Earlier findings:
The new LibreWolf policy file is unusedLibreWolf 156.0.1's loader reads Suggested change: put the prefs as Reproducer (fails at f2d4b9f)Reproducer: LibreWolf never reads the policies.json this PR installsReviewed head: At this head Source (Firefox 156.0.1, the base of LibreWolf 156.0.1-1, the current Arch
Test (PR's test style)Save as #!/bin/bash
# LibreWolf uses Firefox's enterprise policy loader unchanged. On Linux that
# loader reads /etc/<app name>/policies/policies.json when the file exists and
# otherwise the policies.json in the install's distribution directory, never
# both (JSONPoliciesProvider._getLocalConfigurationFile). For LibreWolf the
# first path is /etc/librewolf/policies/policies.json and the second is the
# /usr/lib/librewolf/distribution/policies.json its package ships. Default
# preferences are also read from /etc/librewolf/defaults/pref/*.js.
#
# This runs omarchy-install-browser librewolf with sudo moved into a temporary
# root, then checks that Omarchy's preferences reach a file LibreWolf reads and
# that LibreWolf still reads the policies its package ships.
set -euo pipefail
source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh"
(( EUID != 0 )) || fail "run this test unprivileged; it must not write the real /etc"
test_tmp=$(mktemp -d)
trap 'rm -rf "$test_tmp"' EXIT
fake_root=$test_tmp/root
mock_bin=$test_tmp/bin
mkdir -p "$mock_bin" "$test_tmp/home" "$fake_root/usr/lib/librewolf/distribution"
# Stand-in for the policies.json the librewolf package ships.
printf '%s\n' '{"policies":{"DisableTelemetry":true,"ExtensionSettings":{"uBlock0@raymondhill.net":{"installation_mode":"force_installed"}}}}' \
>"$fake_root/usr/lib/librewolf/distribution/policies.json"
# sudo runs the command unprivileged, with system paths moved under the fake root.
cat >"$mock_bin/sudo" <<'SH'
#!/bin/bash
args=()
skip=0
for arg in "$@"; do
if (( skip )); then
skip=0
continue
fi
case $arg in
-o|-g) skip=1 ;;
/etc/*|/usr/lib/*|/opt/*) args+=("$FAKE_ROOT$arg") ;;
*) args+=("$arg") ;;
esac
done
exec "${args[@]}"
SH
printf '#!/bin/bash\nexit 0\n' >"$mock_bin/omarchy-pkg-add"
chmod +x "$mock_bin"/*
FAKE_ROOT=$fake_root HOME=$test_tmp/home OMARCHY_PATH=$ROOT PATH="$mock_bin:$ROOT/bin:$PATH" \
"$ROOT/bin/omarchy-install-browser" librewolf >/dev/null
policies=$fake_root/etc/librewolf/policies/policies.json
[[ -f $policies ]] || policies=$fake_root/usr/lib/librewolf/distribution/policies.json
written=$(cd "$fake_root" && { find etc -type f 2>/dev/null || true; } | sort | tr '\n' ' ')
prefs_read=false
if grep -q 'widget.wayland.fractional-scale.enabled' "$policies"; then
prefs_read=true
fi
for pref_file in "$fake_root"/etc/librewolf/defaults/pref/*.js; do
if [[ -f $pref_file ]] && grep -q 'widget.wayland.fractional-scale.enabled' "$pref_file"; then
prefs_read=true
fi
done
$prefs_read ||
fail "LibreWolf reads Omarchy's preferences" "LibreWolf reads ${policies#"$fake_root"}; Omarchy wrote: $written"
grep -q 'uBlock0@raymondhill.net' "$policies" ||
fail "LibreWolf keeps the policies its package ships" "LibreWolf reads ${policies#"$fake_root"}; Omarchy wrote: $written"
pass "LibreWolf reads Omarchy's preferences and keeps its own policies"Actual output at f2d4b9f (exit 1)Controls (same test, disposable copies of the head)A. Only moving the file into --- a/bin/omarchy-install-browser
+++ b/bin/omarchy-install-browser
@@ -87,7 +87,7 @@
echo "Installing LibreWolf..."
omarchy-pkg-add librewolf || exit 1
- browser_policy_setup_firefox_distribution /etc/librewolf
+ browser_policy_setup_firefox_distribution /etc/librewolf/policies
setup_firefox_wayland
announce_browser_installed "LibreWolf"
;;B. A LibreWolf-specific file in --- a/bin/omarchy-install-browser
+++ b/bin/omarchy-install-browser
@@ -87,7 +87,7 @@
echo "Installing LibreWolf..."
omarchy-pkg-add librewolf || exit 1
- browser_policy_setup_firefox_distribution /etc/librewolf
+ browser_policy_setup_firefox_distribution /etc/librewolf/policies "$OMARCHY_PATH/default/firefox/librewolf-policies.json"
setup_firefox_wayland
announce_browser_installed "LibreWolf"
;;C. Omarchy's five preferences as a system default-preferences file, --- a/bin/omarchy-install-browser
+++ b/bin/omarchy-install-browser
@@ -87,7 +87,10 @@
echo "Installing LibreWolf..."
omarchy-pkg-add librewolf || exit 1
- browser_policy_setup_firefox_distribution /etc/librewolf
+ browser_policy_setup_parent /etc/librewolf
+ browser_policy_setup_parent /etc/librewolf/defaults
+ browser_policy_setup_parent /etc/librewolf/defaults/pref
+ as_root install -m 644 -o root -g root -T "$OMARCHY_PATH/default/firefox/librewolf-omarchy.js" /etc/librewolf/defaults/pref/omarchy.js
setup_firefox_wayland
announce_browser_installed "LibreWolf"
;;
pref("apz.overscroll.enabled", true);
pref("media.ffmpeg.vaapi.enabled", true);
pref("media.hardware-video-decoding.force-enabled", true);
pref("widget.disable-swipe-tracker", false);
pref("widget.wayland.fractional-scale.enabled", true);The test checks files against the loader's lookup rules taken from the source above. LibreWolf itself was not installed or launched, so B and C are verified against those rules, not in a running browser. The PR's existing DetailsLoader source (Firefox 156.0.1): Optional notes:
Verified:
Earlier findings still present
Reproducer:
|
f2d4b9f to
59c698c
Compare
|
Used the merged-policies option: /etc/librewolf/defaults/pref/ is never read, so I checked the packaged build's EnterprisePoliciesParent.sys.mjs; /etc/librewolf is only consulted for policies/policies.json, and default pref files load from the app dir only. default/librewolf/policies.json is the packaged file plus Omarchy's Preferences, installed to /etc/librewolf/policies/policies.json, with a note to re-copy it when the package changes it. Confirmed in about:policies that both sets apply. Glyph moved to U+E911 since E90F and E910 are both claimed by open PRs (#12137). |
[Medium impact] The changes affect the LibreWolf browser workflow for Omarchy users who install it. The PR still needs the missing English menu entries before merging. Findings
SummaryAdds LibreWolf to browser installation, removal, default selection, and the menu.
Reviews (8) · Last reviewed commit: "Add LibreWolf as supported browser" · Reviewed by Greptile |
| librewolf) | ||
| echo "Removing LibreWolf..." | ||
| set_fallback_default_browser librewolf.desktop | ||
| omarchy-pkg-drop librewolf |
There was a problem hiding this comment.
Removal leaves installed policy
The installer writes an Omarchy-managed file under /etc/librewolf/policies, but this branch only removes the package. If the package transaction does not remove that file, removing LibreWolf leaves the system policy behind. Clean up the file created by the installer during removal.
Knowledge Base Used: Packages, apps, and optional services
|
Thanks for tracking down the policy loader. One maintenance concern: sudo mkdir -p /etc/librewolf/policies
jq -s '.[0] * .[1]' \
/usr/lib/librewolf/distribution/policies.json \
"$OMARCHY_PATH/default/librewolf/policies.json" | # only {"policies": {"Preferences": {...}}}
sudo tee /etc/librewolf/policies/policies.json >/dev/nullWhether LibreWolf joins the supported-browser list at all is a maintainer call. |
59c698c to
680fbdc
Compare
|
Thanks for spotting that. The implementation differs from your snippet in two ways, both to reuse the existing policy helpers:
Totally fine if the PR doesn't get merged; it's just more convenience for LibreWolf users like me :) |
|
Thanks, merging over the packaged file at install time means LibreWolf's own policy updates carry through now. Going through |
| "setup.default.browser.brave-origin": {"icon":"","label":"Brave Origin","checked":"[[ \"$(omarchy-default-browser)\" == \"brave-origin\" ]]","action":"omarchy-default-browser brave-origin"}, | ||
| "setup.default.browser.edge": {"icon":"","label":"Edge","checked":"[[ \"$(omarchy-default-browser)\" == \"edge\" ]]","action":"omarchy-default-browser edge"}, | ||
| "setup.default.browser.firefox": {"icon":"","label":"Firefox","checked":"[[ \"$(omarchy-default-browser)\" == \"firefox\" ]]","action":"omarchy-default-browser firefox"}, | ||
| "setup.default.browser.librewolf": {"icon":"\uE920","iconFont":"omarchy","label":"LibreWolf","checked":"[[ \"$(omarchy-default-browser)\" == \"librewolf\" ]]","action":"omarchy-default-browser librewolf"}, |
There was a problem hiding this comment.
English menu entries are missing
The three new LibreWolf menu entries are missing from default/i18n/en/menu.json. i18n-test.sh requires every menu entry to have a matching English entry, so this change fails that check. The repository instructions also require this mirror. Add English entries for setup.default.browser.librewolf, install.browser.librewolf, and remove.browser.librewolf.
File Used: docs/i18n.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| setup_firefox_wayland | ||
| announce_browser_installed "LibreWolf" |
There was a problem hiding this comment.
LibreWolf skips platform setup
The LibreWolf branch skips omarchy-lifecycle-dispatch post-install librewolf. The repository contract requires every browser installer to run this step after setup and before announcing success. Every other browser branch does so. Add the call here so platform packages can apply their LibreWolf setup. This repository requirement must be satisfied before merging.
| setup_firefox_wayland | |
| announce_browser_installed "LibreWolf" | |
| setup_firefox_wayland | |
| omarchy-lifecycle-dispatch post-install librewolf | |
| announce_browser_installed "LibreWolf" |
File Used: docs/lifecycle-dispatch.md (source)
7b35270 to
6cd88ab
Compare
|
Rebased onto quattro: upstream claimed |
6cd88ab to
3378d37
Compare
Install, select, and remove LibreWolf alongside the other supported browsers. LibreWolf is a Firefox-family browser, so it gets the Firefox policy and Wayland setup, with Omarchy's preferences merged over the policies LibreWolf ships. Selecting an already-installed LibreWolf must skip the Chromium-only extension check, which rejects it and prevents the default from changing.
14432e4 to
6262433
Compare
Signed-off-by: TheBananaPancake 256630335+TheBananaPancake@users.noreply.github.com