From b53bd83006924e4a6cb607664c9c95f7b5c53605 Mon Sep 17 00:00:00 2001 From: Kopatz <7265381+Kropatz@users.noreply.github.com> Date: Thu, 6 Nov 2025 16:59:13 +0100 Subject: [PATCH] mimetypes --- home-manager/nixvim/default.nix | 16 +++++++++++ modules/graphical/shared.nix | 47 ++++++++++++++++++++++++++++++++- 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/home-manager/nixvim/default.nix b/home-manager/nixvim/default.nix index 285f1e9..caa804b 100644 --- a/home-manager/nixvim/default.nix +++ b/home-manager/nixvim/default.nix @@ -56,4 +56,20 @@ in }; home.packages = with pkgs; [ nixfmt-rfc-style ]; # nixd config option to set nixpkgs-fmt should work, but it doesn't programs.nixvim = merged; + xdg.desktopEntries = { + neovim = { + name = "Neovim"; + exec = "kitty nvim"; + icon = "nvim"; + type = "Application"; + categories = [ + "Utility" + "TextEditor" + ]; + mimeType = [ + "text/markdown" + "text/plain" + ]; + }; + }; } diff --git a/modules/graphical/shared.nix b/modules/graphical/shared.nix index d0cf294..4a4ce6d 100644 --- a/modules/graphical/shared.nix +++ b/modules/graphical/shared.nix @@ -27,7 +27,7 @@ in fonts.packages = with pkgs; [ #uw-ttyp0 #corefonts - #nerd-fonts.noto + #nerd-fonts.noto noto-fonts nerd-fonts.hack #noto-fonts @@ -86,5 +86,50 @@ in adwaita-icon-theme zenity ]; + xdg.terminal-exec = { + enable = true; + settings = { + default = [ + "kitty.desktop" + ]; + }; + }; + xdg.mime = + let + mkAssociation = + desktop: mimeTypes: + (map (name: { + inherit name; + value = desktop; + }) mimeTypes) + |> builtins.listToAttrs; + associations = + mkAssociation "firefox.desktop" [ + "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/pdf" + "text/html" + ] + // mkAssociation "neovim.desktop" [ + "application/json" + "text/markdown" + "text/plain" + ]; + in + { + enable = true; + addedAssociations = associations; + defaultApplications = associations; + }; }; }