diff --git a/nix/configurations/vanadium/home/firefox.nix b/nix/configurations/vanadium/home/firefox.nix index 42373181..bc3fef14 100644 --- a/nix/configurations/vanadium/home/firefox.nix +++ b/nix/configurations/vanadium/home/firefox.nix @@ -1,20 +1,44 @@ { 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 = "searxng"; + 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"; + } ]; };