{ pkgs, config, lib, ... }: let inherit (pkgs) nur; in { programs.firefox = { enable = true; policies = { SearchEngines = { Default = "Google en@en"; Remove = ["Google"]; Add = let lrValues = ["lang_fr" "lang_en" "lang_zh-TW"]; hlValues = ["fr" "en" "zh-TW"]; in # Google specialized for each language x display language # reference: https://developers.google.com/custom-search/docs/xml_results?hl=zh-tw#advanced-search-query-parameters lib.mapCartesianProduct ( { lr, hl, }: let lr' = lib.substring 0 2 (lib.removePrefix "lang_" lr); hl' = lib.substring 0 2 hl; in { Name = "Google ${lr'}@${hl'}"; Alias = if (lib.removePrefix "lang_" lr == hl) then "@G" + lr' else "@G" + lr' + hl'; Description = "Your data yum yum (but ${lr'} in ${hl'})"; IconURL = "https://google.com/favicon.ico"; SuggestURLTemplate = "https://suggestqueries.google.com/complete/search?q={searchTerms}&lr=${lr}&hl=${hl}"; URLTemplate = "https://google.com/search?q={searchTerms}&lr=${lr}&hl=${hl}"; } ) { lr = lrValues; hl = hlValues; } ++ [ # Forges { Name = "GitHub"; Alias = "@ggh"; IconURL = "https://github.com/favicon.ico"; Description = "Your code yum yum"; URLTemplate = "https://github.com/search?q={searchTerms}&type=repositories"; } { Name = "GitHub (Code Search)"; Alias = "@gghc"; IconURL = "https://github.com/favicon.ico"; Description = "Your code yum yum"; URLTemplate = "https://github.com/search?q={searchTerms}&type=code"; } { Name = "Codeberg"; Alias = "@gco"; IconURL = "https://codeberg.org/favicon.ico"; Description = "Software development, but free!"; URLTemplate = "https://codeberg.org/explore/repos?q={searchTerms}"; } { Name = "?C"; Alias = "@gcc"; IconURL = "https://git.confusedcompiler.org/favicon.ico"; URLTemplate = "https://git.confusedcompiler.org/explore/repos?q={searchTerms}"; } # Nix{,OS,pkgs} { Name = "NixOS Search (Package)"; Alias = "@np"; IconURL = "https://nixos.org/favicon.ico"; Description = "Search in nixpkgs"; URLTemplate = "https://search.nixos.org/packages?query={searchTerms}"; } { Name = "NixOS Search (Options)"; Alias = "@no"; IconURL = "https://nixos.org/favicon.ico"; Description = "Search in NixOS options"; URLTemplate = "https://search.nixos.org/options?query={searchTerms}"; } # Discourse { Name = "NixOS Discourse"; Alias = "@nd"; IconURL = "https://nixos.org/favicon.ico"; URLTemplate = "https://discourse.nixos.org/search?q={searchTerms}"; } { Name = "Framework Discourse"; Alias = "@fd"; IconURL = "https://frame.work/favicon.ico"; URLTemplate = "https://community.frame.work/search?q={searchTerms}"; } # Misc { Name = "YouTube"; Alias = "@yt"; IconURL = "https://youtube.com/favicon.ico"; SuggestURLTemplate = "http://suggestqueries.google.com/complete/search?q={searchTerms}&ds=yt"; URLTemplate = "https://www.youtube.com/results?search_query={searchTerms}"; } { Name = "Genius"; Alias = "@geni"; IconURL = "https://genius.com/favicon.ico"; URLTemplate = "https://genius.com/search?q={searchTerms}"; } ]; }; }; 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]; }; }; }; }