{ pkgs, config, lib, ... }: with lib; let cfg = config.eboskma.programs.firefox; profileSettings = { "browser.shell.checkDefaultBrowser" = false; "browser.translations.enable" = false; "devtools.theme" = "dark"; "extensions.quarantinedDomains.enabled" = false; "gfx.webrender.all" = true; "image.avif.enabled" = true; "image.webp.enabled" = true; "media.encoder.webm.enabled" = true; "media.ffmpeg.encoder.enabled" = true; "media.ffmpeg.vaapi.enabled" = true; "media.rdd-ffmpeg.enabled" = true; "media.webrtc.platformencoder" = true; "media.webrtc.platformencoder.sw_only" = false; "media.webrtc.software_encoder.fallback" = true; "privacy.webrtc.allowSilencingNotifications" = true; "privacy.webrtc.legacyGlobalIndicator" = false; "security.tls.enable_0rtt_data" = false; "ui.key.menuAccessKeyFocuses" = false; "widget.content.allow-gtk-dark-theme" = true; }; nonDefaultDesktop = pkgs.makeDesktopItem { name = "firefox-" + (if cfg.work then "private" else "horus"); desktopName = "Firefox (" + (if cfg.work then "Personal" else "Horus") + ")"; exec = "firefox -P " + (if cfg.work then "private" else "horus") + " %u"; icon = "firefox"; categories = [ "GNOME" "GTK" "Network" "WebBrowser" ]; mimeTypes = [ "text/html" "text/xml" "application/xhtml+xml" "application/xml" "application/rss+xml" "application/rdf+xml" "image/gif" "image/jpeg" "image/png" "x-scheme-handler/http" "x-scheme-handler/https" "x-scheme-handler/ftp" "x-scheme-handler/chrome" "video/webm" "application/x-xpinstall" ]; startupNotify = true; extraConfig = { "X-MultipleArgs" = "false"; }; }; in { options.eboskma.programs.firefox = { enable = mkEnableOption "enable firefox"; work = mkOption { description = "whether this is a work config"; type = types.bool; default = false; }; }; config = mkIf cfg.enable { programs.firefox = { enable = true; package = pkgs.firefox.override { cfg = { enableGnomeExtensions = true; enableSpeechSynthesisSupport = true; }; }; profiles = { private = { id = 0; isDefault = !cfg.work; settings = profileSettings; }; horus = { id = 1; isDefault = cfg.work; settings = profileSettings; }; }; }; home.packages = [ nonDefaultDesktop ]; }; }