From 817576c3fbd03637099c6e5eb29932d651cbdb1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Fri, 30 May 2025 14:36:09 +0200 Subject: [PATCH] firefox: better custom google search engine --- nix/configurations/vanadium/home/firefox.nix | 44 ++++++++++---------- nix/homeModules/common/firefox.nix | 3 ++ 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/nix/configurations/vanadium/home/firefox.nix b/nix/configurations/vanadium/home/firefox.nix index bc3fef14..6a61081e 100644 --- a/nix/configurations/vanadium/home/firefox.nix +++ b/nix/configurations/vanadium/home/firefox.nix @@ -19,27 +19,29 @@ 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"; - } - ]; + policies = { + RequestedLocales = ["fr" "en-US" "zh-TW"]; + + SearchEngines = { + Default = "Google Customized"; + Remove = ["Google"]; + Add = [ + (let + withFlags = x: + x + + mkLrFlag ["lang_fr" "lang_en" "lang_zh-TW"] + + mkGlFlag "fr" + + mkHlFlag "fr"; + in { + Name = "Google Customized"; + Alias = "G"; + IconURL = "https://google.com/favicon.ico"; + Description = "Your data yum yum"; + SuggestURLTemplate = withFlags "https://suggestqueries.google.com/complete/search?q={searchTerms}"; + URLTemplate = withFlags "https://google.com/search?q={searchTerms}"; + }) + ]; + }; }; profiles = { diff --git a/nix/homeModules/common/firefox.nix b/nix/homeModules/common/firefox.nix index 0fe04691..9cf9cf1e 100644 --- a/nix/homeModules/common/firefox.nix +++ b/nix/homeModules/common/firefox.nix @@ -7,6 +7,9 @@ in { # https://mozilla.github.io/policy-templates policies = { + SearchEngines = { + Remove = ["Bing" "DuckDuckGo" "Qwant" "eBay"]; + }; HardwareAcceleration = true; DisableFirefoxScreenshots = false; DisablePocket = true;