From 7fa4a0b898557049811ab2513c485c18f2785b75 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Wed, 13 Sep 2023 19:57:39 +0100 Subject: [PATCH] Add some more mime-types and improve query func --- home/hyprland/default.nix | 21 ++++++++++++--------- home/shell/zsh.nix | 6 +++++- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/home/hyprland/default.nix b/home/hyprland/default.nix index 4f821f63..31e300e2 100644 --- a/home/hyprland/default.nix +++ b/home/hyprland/default.nix @@ -51,16 +51,19 @@ "hypr/macchiato.conf".source = ./macchiato.conf; "hypr/extra.conf" = lib.mkDefault { text = ""; }; }; - mimeApps = { + mimeApps = let + associations = { + "image/jpeg" = [ "swayimg.desktop" ]; + "image/png" = [ "swayimg.desktop" ]; + "application/pdf" = [ "zathura.desktop" "emacs.desktop" ]; + "application/json" = [ "emacs.desktop" "firefox.desktop" ]; + "application/x-yaml" = [ "emacs.desktop" ]; + "text/csv" = [ "calc.desktop" "emacs.desktop" ]; + }; + in { enable = true; - defaultApplications = { - "image/jpeg" = [ "swayimg.desktop" ]; - "image/png" = [ "swayimg.desktop" ]; - }; - associations.added = { - "image/jpeg" = [ "swayimg.desktop" ]; - "image/png" = [ "swayimg.desktop" ]; - }; + defaultApplications = associations; + associations.added = associations; }; }; } diff --git a/home/shell/zsh.nix b/home/shell/zsh.nix index d97ac715..545118d0 100644 --- a/home/shell/zsh.nix +++ b/home/shell/zsh.nix @@ -15,7 +15,11 @@ source ${catppuccin-themes.zsh} ''; initExtra = '' - xdg-query-program () { xdg-mime query default $(xdg-mime query filetype $@) } + xdg-query-program () { + FILETYPE=$(xdg-mime query filetype $@) + DEFAULT=$(xdg-mime query default $FILETYPE) + echo "$FILETYPE -> $DEFAULT" + } ''; oh-my-zsh = { enable = true;