add librewolf mobile config

This commit is contained in:
Henry Hiles 2026-11-17 00:29:59 -05:00
commit 527374059e
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
4 changed files with 54 additions and 10 deletions

8
flake.lock generated
View file

@ -81,11 +81,11 @@
]
},
"locked": {
"lastModified": 1794892328,
"narHash": "sha256-9QMpzIs+e2zhK62ErBzi6sHOwKtUM2cAiMOuRVPxbE8=",
"lastModified": 1794892850,
"narHash": "sha256-7kOT7EWzzNnKvuuPkTx9HciJ7Kd1ZrUbZJcwKgqq+w0=",
"ref": "refs/heads/main",
"rev": "42d273798b72ab517413738c323164382d74b3d3",
"revCount": 3,
"rev": "ab0704e682c8b394edbec55c2b7b83d1601f7da8",
"revCount": 4,
"type": "git",
"url": "https://git.federated.nexus/Henry-Hiles/app-grid"
},

View file

@ -134,3 +134,11 @@
--gnome-private-text-primary-color: #fbfbfe;
}
}
/* Phone only: quad.mobile is set in modules/mobile/librewolf.nix. The mobile layout turns the URL
* bar results into a sheet over the page, but the theme makes its background transparent. */
@media -moz-pref("quad.mobile") {
.urlbarView {
background: var(--gnome-menu-background) !important;
}
}

View file

@ -133,6 +133,8 @@
value = {
install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${id}/latest.xpi";
installation_mode = "force_installed";
# In the extensions menu, not as separate toolbar buttons
default_area = "menupanel";
};
})
[
@ -141,15 +143,9 @@
"sponsorBlocker@ajay.app"
"firefox@tampermonkey.net"
"firefox-addon@pronoundb.org"
"jid1-MnnxcxisBPnSXQ@jetpack" # Privacy Badger
"frankerfacez@frankerfacez.com"
"7esoorv3@alefvanoon.anonaddy.me" # LibRedirect
"{de621c74-2aa6-4c91-a2da-28d445b66bab}" # YouTube Livestreams Theater Mode
"{cf3dba12-a848-4f68-8e2d-f9fadc0721de}" # Google Lighthouse
"{446900e4-71c2-419f-a6a7-df9c091e268b}" # Bitwarden
"{4ce83447-8255-43c2-b8f7-e02eb8c2cc39}" # Draw on Page
"{ac34afe8-3a2e-4201-b745-346c0cf6ec7d}" # Better Youtube Shorts
"{a6c4a591-f1b2-4f03-b3ff-767e5bedf4e7}" # User-Agent Switcher and Manager
"enhancerforyoutube@maximerf.addons.mozilla.org"
]
)

View file

@ -0,0 +1,40 @@
{ pkgs, ... }:
# The mobile layout from postmarketOS's mobile-config-firefox, the same way nixpkgs' firefox-mobile
# adds it, but on top of the LibreWolf set up in graphical/librewolf.
let
src = pkgs.fetchFromGitLab {
domain = "gitlab.nura.eco";
owner = "nura";
repo = "mobile-config-firefox";
rev = "5.5.1";
hash = "sha256-kIMeVKUI8/MdCJIkBlcYYEUnN7+ciDpKuReAeKkn8VY=";
};
configDir = pkgs.runCommand "mobile-config-firefox" { } ''
mkdir -p $out
cp -r ${src}/src/modules/. $out/
cp -r ${src}/src/themes $out/
'';
# It logs into <profile>/chrome, which is a read-only theme from the store here, and failing to
# open the log stops it from loading at all. Log into the profile itself instead.
autoconfig = pkgs.runCommand "mobile-config-autoconfig.js" { } ''
substitute ${src}/src/mobile-config-autoconfig.js $out \
--replace-fail "/usr/lib/mobile-config-firefox" "${configDir}" \
--replace-fail 'var logFile = g_chromeDir.clone();' 'var logFile = Services.dirsvc.get("ProfD", Ci.nsIFile);'
'';
# The wrapper sets up autoconfig itself
prefs = pkgs.runCommand "mobile-config-prefs.js" { } ''
grep -v -e general.config.filename -e general.config.obscure_value \
-e general.config.sandbox_enabled ${src}/src/mobile-config-prefs.js > $out
'';
in
{
programs.firefox.autoConfigFiles = [
autoconfig
prefs
# Lets graphical/librewolf/customChrome.css fix things up for the mobile layout only
(pkgs.writeText "quad-mobile-prefs.js" ''defaultPref("quad.mobile", true);'')
];
}