NixOS-Config/modules/home/programs/gui/librewolf/default.nix

159 lines
5.2 KiB
Nix

{ pkgs, config, ... }:
let
# FireFox theme, based on https://github.com/Dook97/firefox-qutebrowser-userchrome
themeFont = ''
--tab-font: '${config.look.fonts.main}';
--urlbar-font: '${config.look.fonts.main}';
'';
themeJim = ''
:root {
--tab-active-bg-color: #${config.look.colors.prime};
--tab-hover-bg-color: #${config.look.colors.accent};
--tab-inactive-bg-color: #${config.look.colors.dark};
--tab-active-fg-fallback-color: #FFFFFF;
--tab-inactive-fg-fallback-color: #${config.look.colors.text};
--urlbar-focused-bg-color: #${config.look.colors.dark};
--urlbar-not-focused-bg-color: #${config.look.colors.dark};
--toolbar-bgcolor: #${config.look.colors.dark} !important;
'';
themeAlt = ''
:root {
--tab-active-bg-color: #${config.look.colors.dark};
--tab-hover-bg-color: #${config.look.colors.accent};
--tab-inactive-bg-color: #${config.look.colors.prime};
--tab-active-fg-fallback-color: #${config.look.colors.text};
--tab-inactive-fg-fallback-color: #FFFFFF;
--urlbar-focused-bg-color: #${config.look.colors.prime};
--urlbar-not-focused-bg-color: #${config.look.colors.prime};
--toolbar-bgcolor: #${config.look.colors.prime} !important;
'';
in {
# Enable Librewolf and extensions
programs.firefox = let
commonExtensions = with config.nur.repos.rycee.firefox-addons; [
ublock-origin
bitwarden
darkreader
sponsorblock
return-youtube-dislikes
simple-tab-groups
vimium
];
commonSearch = {
force = true;
default = "Google";
engines = {
"Google" = {
urls = [
{
template = "https://www.google.com/search";
params = [
{
name = "q";
value = "{searchTerms}";
}
];
}
];
definedAliases = [ "@g" ];
};
"NixPKGs" = {
urls = [
{
template = "https://search.nixos.org/packages";
params = [
{
name = "type";
value = "packages";
}
{
name = "query";
value = "{searchTerms}";
}
];
}
];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = [ "@pkgs" ];
};
};
};
commonSettings = {
"font.name.serif.x-western" = "${config.look.fonts.main}";
"font.name.sans-serif.x-western" = "${config.look.fonts.main}";
"font.name.monospace.x-western" = "${config.look.fonts.nerd}";
"general.autoScroll" = true;
"browser.compactmode.show" = true;
"browser.uidensity" = 1;
"browser.startup.page" = 3;
"extensions.pocket.enabled" = false;
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
"privacy.userContext.newTabContainerOnLeftClick.enabled" = true;
"privacy.clearOnShutdown.history" = false;
"privacy.clearOnShutdown.cookies" = false;
"privacy.clearOnShutdown_v2.cookiesAndStorage" = false;
"browser.toolbars.bookmarks.visibility" = "never";
"media.hardware-video-decoding.force-enabled" = true;
"svg.context-properties.content.enabled" = true;
"toolkit.tabbox.switchByScrolling" = true;
"device.sensors.motion.enabled" = false;
"extensions.autoDisableScopes" = 0;
"gnomeTheme.hideSingleTab" = true;
"browser.contentblocking.category" = "strict";
"urlclassifier.trackingSkipURLs" = "*.reddit.com, *.twitter.com, *.twimg.com, *.tiktok.com";
"urlclassifier.features.socialtracking.skipURLs" = "*.instagram.com, *.twitter.com, *.twimg.com";
"network.cookie.sameSite.noneRequiresSecure" = true;
"browser.helperApps.deleteTempFileOnExit" = true;
"privacy.globalprivacycontrol.enabled" = true;
"privacy.globalprivacycontrol.functionality.enabled" = true;
"webgl.disabled" = false;
};
in {
enable = true;
package = pkgs.librewolf;
profiles = {
Main = {
id = 0;
extensions = commonExtensions;
search = commonSearch;
settings = commonSettings;
userChrome = ''
${themeJim}
${themeFont}
${builtins.readFile ./quteFox.css}
'';
};
Alt = {
id = 1;
extensions = commonExtensions;
search = commonSearch;
settings = commonSettings;
userChrome = ''
${themeAlt}
${themeFont}
${builtins.readFile ./quteFox.css}
'';
};
Misc = {
id = 2;
extensions = commonExtensions;
search = commonSearch;
settings = commonSettings;
containersForce = true;
};
};
};
# Fixes
home.file = {
# Symlinks to Librewolf
".librewolf".source = config.lib.file.mkOutOfStoreSymlink "/home/jimbo/.mozilla/firefox";
# Gnome theme
".mozilla/firefox/Misc/chrome".source = "${fetchTarball {
url = "https://github.com/rafaelmardojai/firefox-gnome-theme/archive/refs/tags/v129.zip";
sha256 = "14x0vp66i8b14q6c9n75sa88fcwy9jd9lik8sjnab2rnwlskvq9h";
}}";
};
}