From f4193012f9793eadf2632fdcb90af081abd68263 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Tue, 13 Aug 2024 17:13:47 -0400 Subject: [PATCH] librewolf: Use mobile-friendly-firefox styles This makes LibreWolf work well on the PinePhone without having to manually use the FriendlyFox installation script. Note that FriendlyFox was chosen over the mobile-config-firefox script from postmarketOS due to FriendlyFox having less issues overall, such as not breaking when the right click menu is long and popup menus having altered styles for mobile support. --- home/librewolf.nix | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/home/librewolf.nix b/home/librewolf.nix index 1e73bdf0..15362a87 100644 --- a/home/librewolf.nix +++ b/home/librewolf.nix @@ -1,5 +1,36 @@ { pkgs, ... }: +let + friendlyfox = pkgs.stdenvNoCC.mkDerivation (finalAttrs: { + pname = "mobile-friendly-firefox"; + version = "2.11.1"; + + src = pkgs.fetchFromGitea { + domain = "codeberg.org"; + owner = "user0"; + repo = "Mobile-Friendly-Firefox"; + rev = "v${finalAttrs.version}"; + hash = "sha256-rA5lnfW5zOyfJ6pbcrsTBEhMEof5h/heGaHxST+q+AY="; + }; + + patches = [ + # Fix for Firefox 127 and later (renamed id) + (pkgs.fetchpatch2 { + url = "https://codeberg.org/user0/Mobile-Friendly-Firefox/commit/bfb7946973bf707d0494714679df47ec66017f97.patch"; + hash = "sha256-wJLXgNUUaNHVgCMi8sGnC5cx2yNwZwh2JoDaVMsVehY="; + }) + ]; + + installPhase = '' + runHook preInstall + + install -Dm644 src/userContent/styles/fenix-colors/userContent.css -t $out + cat src/userChrome/fenix_one.css src/userChrome/dynamic_popups_pro.css > $out/userChrome.css + + runHook postInstall + ''; + }); +in { programs.librewolf = { enable = true; @@ -46,4 +77,9 @@ "toolkit.legacyUserProfileCustomizations.stylesheets" = true; }; }; + + home.file = { + ".librewolf/default/chrome/userChrome.css".source = "${friendlyfox}/userChrome.css"; + ".librewolf/default/chrome/userContent.css".source = "${friendlyfox}/userContent.css"; + }; }