.files/nix/configurations/vanadium/home/firefox.nix

119 lines
2.9 KiB
Nix

{
pkgs,
config,
lib,
...
}: let
inherit (pkgs) nur;
# reference: https://developers.google.com/custom-search/docs/xml_results?hl=zh-tw#advanced-search-query-parameters
mkLrFlag = languageRestrictions:
"&lr=" + lib.escapeURL (builtins.concatStringsSep "|" languageRestrictions);
mkGlFlag = preferredCountry:
"&gl=" + preferredCountry;
mkHlFlag = hostLanguage:
"&hl=" + hostLanguage;
in {
programs.firefox = {
enable = true;
policies.SearchEngines = {
Default = "Google Customized";
Add = [
/*
searxng doesn't
- have good multilingual search support
- use google backend on my server for some reason
*/
{
Name = "searxng";
URLTemplate = "https://sxng.confusedcompiler.org/search?q={searchTerms}";
}
{
Name = "Google Customized";
URLTemplate =
"https://google.com/search?q={searchTerms}"
+ mkLrFlag ["lang_fr" "lang_en" "lang_zh-TW"]
+ mkGlFlag "fr"
+ mkHlFlag "fr";
}
];
};
profiles = {
default = {
userChrome = ''
/* Only works in Firefox if layout.css.has-selector.enabled is set to true in about:config . */
html#main-window body:has(#sidebar-box[sidebarcommand=treestyletab_piro_sakura_ne_jp-sidebar-action][checked=true]:not([hidden=true])) #TabsToolbar {
visibility: collapse !important;
}
/* monofont tweak */
#statuspanel-label {
font-family: monospace;
}
.urlbar-input-box {
font-family: monospace;
}
'';
settings = {
"layout.css.has-selector.enabled" = true;
};
extensions.packages = let
addons = nur.repos.rycee.firefox-addons;
in [
addons.sponsorblock
addons.return-youtube-dislikes
addons.shinigami-eyes
addons.consent-o-matic
addons.tree-style-tab
];
};
junk = {
id = 1;
inherit
(config.programs.firefox.profiles.default)
settings
userChrome
;
extensions.packages = let
addons = nur.repos.rycee.firefox-addons;
in [addons.multi-account-containers];
containers = {
raisin = {
color = "purple";
icon = "fruit";
id = 1;
};
pomme = {
color = "red";
icon = "fruit";
id = 2;
};
};
};
# Isolate it because it's proprietary
tampermonkey = {
id = 2;
inherit
(config.programs.firefox.profiles.default)
settings
userChrome
;
extensions.packages = let
addons = nur.repos.rycee.firefox-addons;
in [addons.tampermonkey];
};
};
};
}