From de224ad756e040c8138b8b5d9286f1d1b1660b27 Mon Sep 17 00:00:00 2001 From: xezo360hye Date: Mon, 12 Aug 2024 22:22:31 +0300 Subject: [PATCH] feat(home): improve firefox configs and fix plasma integration --- home/modules/firefox.nix | 108 ++++++++++++++++++++++++++++++--------- home/modules/plasma.nix | 14 +++-- 2 files changed, 93 insertions(+), 29 deletions(-) diff --git a/home/modules/firefox.nix b/home/modules/firefox.nix index 31ef9e1..1fa2aba 100644 --- a/home/modules/firefox.nix +++ b/home/modules/firefox.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ lib, pkgs, ... }: { programs.firefox = { enable = true; @@ -19,52 +19,121 @@ }; }; + extensions = with pkgs.nur.repos.rycee.firefox-addons; [ + ublock-origin + private-relay + libredirect + + reddit-enhancement-suite + enhancer-for-youtube + qr-code-address-bar + ]; + + settings = { + "browser.newtabpage.pinned" = [ + { + label = "Arch Wiki"; + url = "https://wiki.archlinux.org"; + } + { + label = "Translate"; + url = "https://mozhi.pussthecat.org"; + } + { + label = "ChatGPT"; + url = "https://chatgpt.com"; + } + { + label = "YouTube"; + url = "https://youtube.com"; + } + { + label = "Reddit"; + url = "https://old.reddit.com"; + } + { + label = "4chan"; + url = "https://www.4chan.org/frames"; + } + ]; + + "browser.aboutConfig.showWarning" = false; + "browser.translations.automaticallyPopup" = false; + "browser.tabs.inTitlebar" = 0; + + "services.sync.engine.addons" = false; + "services.sync.username" = "xezo360hye@gmail.com"; + + "toolkit.legacyUserProfileCustomizations.stylesheets" = true; + "extensions.autoDisableScopes" = 0; + }; + search = { force = true; default = "DuckDuckGo"; - engines = { + + engines = let + makeShortcuts = let + prefix = "@"; + in map (shortcut: prefix + shortcut); + + hideEngines = let + hideEngine = engine: { + name = engine; + value = { + metaData.hidden = true; + }; + }; + in engines: lib.listToAttrs (map hideEngine engines); + in (hideEngines [ "Google" "Bing" "Amazon.com" "eBay" ]) // + { + "Arch Wiki" = { + urls = [{ template = "https://wiki.archlinux.org/index.php?search={searchTerms}"; }]; + iconUpdateURL = "https://wiki.archlinux.org/favicon.ico"; + definedAliases = makeShortcuts [ "archlinux" "aw" ]; + }; + "Nix Packages" = { urls = [{ template = "https://search.nixos.org/packages"; params = [ { name = "type"; value = "packages"; } + { name = "channel"; value = "unstable"; } { name = "query"; value = "{searchTerms}"; } ]; }]; icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; - definedAliases = [ "@np" ]; + definedAliases = makeShortcuts [ "nixpkgs" "packages" "np" ]; }; "NixOS Wiki" = { - urls = [{ template = "https://wiki.nixos.org/index.php?search={searchTerms}"; }]; + urls = [{ template = "https://wiki.nixos.org/w/index.php?search={searchTerms}"; }]; iconUpdateURL = "https://wiki.nixos.org/favicon.png"; - updateInterval = 24 * 60 * 60 * 1000; - definedAliases = [ "@nw" ]; + definedAliases = makeShortcuts [ "nixos" "nw" ]; }; "MyNixOS" = { urls = [{ template = "https://mynixos.com/search?q={searchTerms}"; }]; iconUpdateURL = "https://mynixos.com/favicon-light.svg"; - definedAliases = [ "@mn" "@mw" ]; + definedAliases = makeShortcuts [ "mynixos" "mw" ]; }; - "Bing".metaData.hidden = true; - "Google".metaData.hidden = true; - "Amazon.com".metaData.hidden = true; - "eBay".metaData.hidden = true; + "RuTracker" = { + urls = [{ template = "https://rutracker.org/forum/tracker.php?nm={searchTerms}"; }]; + iconUpdateURL = "https://rutracker.org/favicon.ico"; + definedAliases = makeShortcuts [ "rutracker" "rt" ]; + }; }; }; }; policies = { + DontCheckDefaultBrowser = true; DisableFirefoxStudies = true; DisableTelemetry = true; DisablePocket = true; - DontCheckDefaultBrowser = true; - DownloadDirectory = "\${home}"; - EnableTrackingProtection = { Value = true; Locked = false; @@ -78,20 +147,11 @@ FirefoxHome = { SponsoredTopSites = false; - - Pocket = false; SponsoredPocket = false; + Pocket = false; }; StartDownloadsInTempDirectory = true; - TranslateEnabled = true; - - Preferences = { - "browser.translations.automaticallyPopup" = { - Value = false; - Status = "default"; - }; - }; }; }; } diff --git a/home/modules/plasma.nix b/home/modules/plasma.nix index 71a68b3..b4c3b40 100644 --- a/home/modules/plasma.nix +++ b/home/modules/plasma.nix @@ -1,11 +1,15 @@ { pkgs, ... }: { - programs.firefox.profiles.default = { - extensions = [ pkgs.nur.repos.rycee.firefox-addons.plasma-integration ]; + programs.firefox = { + nativeMessagingHosts = [ pkgs.plasma-browser-integration ]; - settings = { - "widget.use-xdg-desktop-portal.file-picker" = 1; - "media.hardwaremediakeys.enabled" = false; + profiles.default = { + extensions = [ pkgs.nur.repos.rycee.firefox-addons.plasma-integration ]; + + settings = { + "widget.use-xdg-desktop-portal.file-picker" = 1; + "media.hardwaremediakeys.enabled" = false; + }; }; };