From 1bec3a93a0dba88174f46b9e5919e6f9e345a69c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Wed, 26 Nov 2025 15:12:24 +0800 Subject: [PATCH] vanadium: improve browser xdg configuration --- nix/homeModules/common/firefox.nix | 2 +- nix/homeModules/common/zen-browser.nix | 41 +++++++++++--------------- 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/nix/homeModules/common/firefox.nix b/nix/homeModules/common/firefox.nix index d479571b..853888c9 100644 --- a/nix/homeModules/common/firefox.nix +++ b/nix/homeModules/common/firefox.nix @@ -140,7 +140,7 @@ in "x-scheme-handler/unknown" = "firefox.desktop"; }; in - lib.mkIf cfg.enable { + lib.mkIf (cfg.enable && !config.programs.zen-browser.enable) { enable = true; associations.added = associations; defaultApplications = associations; diff --git a/nix/homeModules/common/zen-browser.nix b/nix/homeModules/common/zen-browser.nix index b490d95b..c6681318 100644 --- a/nix/homeModules/common/zen-browser.nix +++ b/nix/homeModules/common/zen-browser.nix @@ -134,30 +134,23 @@ in xdg.mimeApps = let - associations = builtins.listToAttrs ( - map - (name: { - inherit name; - value = cfg.package.meta.desktopFileName; - }) - [ - "application/x-extension-shtml" - "application/x-extension-xhtml" - "application/x-extension-html" - "application/x-extension-xht" - "application/x-extension-htm" - "x-scheme-handler/unknown" - "x-scheme-handler/mailto" - "x-scheme-handler/chrome" - "x-scheme-handler/about" - "x-scheme-handler/https" - "x-scheme-handler/http" - "application/xhtml+xml" - "application/json" - "text/plain" - "text/html" - ] - ); + associations = lib.genAttrs [ + "application/x-extension-shtml" + "application/x-extension-xhtml" + "application/x-extension-html" + "application/x-extension-xht" + "application/x-extension-htm" + # "x-scheme-handler/unknown" + # "x-scheme-handler/mailto" + "x-scheme-handler/chrome" + "x-scheme-handler/about" + "x-scheme-handler/https" + "x-scheme-handler/http" + "application/xhtml+xml" + # "application/json" + # "text/plain" + "text/html" + ] (_: cfg.package.meta.desktopFileName); in lib.mkIf cfg.enable { associations.added = associations;