From 1661ceccccbec79598df085b7c5aa43509d4b0c4 Mon Sep 17 00:00:00 2001 From: LavaDesu Date: Thu, 27 May 2021 12:54:33 +0700 Subject: [PATCH] configure xdg mimes --- users/rin/home.nix | 7 +------ users/rin/xdg.nix | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 users/rin/xdg.nix diff --git a/users/rin/home.nix b/users/rin/home.nix index be1ec55..fea6414 100644 --- a/users/rin/home.nix +++ b/users/rin/home.nix @@ -25,6 +25,7 @@ imports = [ ./gtk.nix + ./xdg.nix ./alacritty.nix ./neovim.nix @@ -39,12 +40,6 @@ ./i3.nix ]; - xdg = { - enable = true; - mime.enable = true; - mimeApps.enable = true; - }; - programs = { feh.enable = true; diff --git a/users/rin/xdg.nix b/users/rin/xdg.nix new file mode 100644 index 0000000..1106c5f --- /dev/null +++ b/users/rin/xdg.nix @@ -0,0 +1,31 @@ +{ config, ... }: +let + genFF = mimeTypes: builtins.listToAttrs (builtins.map (mimeType: { + name = mimeType; + value = "firefox.desktop"; + }) mimeTypes); + + ffMimes = genFF [ + "x-scheme-handler/http" + "x-scheme-handler/https" + "x-scheme-handler/chrome" + "text/html" + "application/x-extension-htm" + "application/x-extension-html" + "application/x-extension-shtml" + "application/xhtml+xml" + "application/x-extension-xhtml" + "application/x-extension-xht" + ]; +in { + xdg = { + enable = true; + mime.enable = true; + mimeApps = { + enable = true; + + associations.added = ffMimes; + defaultApplications = ffMimes; + }; + }; +}