From 600fd0697475a2ab9f2fed0a9c23e48caa5bc310 Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Mon, 3 Apr 2023 21:54:53 -0400 Subject: [PATCH] fix nautilus and xdg mimetypes discovered sushi is not working, however --- modules/common/applications/media.nix | 6 +++++- modules/common/applications/nautilus.nix | 26 +++++++++++++++++++++--- modules/common/neovim/default.nix | 5 +++-- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/modules/common/applications/media.nix b/modules/common/applications/media.nix index 994f500..9152bc7 100644 --- a/modules/common/applications/media.nix +++ b/modules/common/applications/media.nix @@ -50,11 +50,15 @@ xdg.mimeApps = { associations.added = { "application/pdf" = [ "pwmt.zathura-cb.desktop" ]; + "image/jpeg" = [ "nsxiv.desktop" ]; "image/*" = [ "nsxiv.desktop" ]; }; - associations.removed = { "application/pdf" = [ "mupdf.desktop" ]; }; + associations.removed = { + "application/pdf" = [ "mupdf.desktop" "wine-extension-pdf.desktop" ]; + }; defaultApplications = { "application/pdf" = [ "pwmt.zathura-cb.desktop" ]; + "image/jpeg" = [ "nsxiv.desktop" ]; "image/*" = [ "nsxiv.desktop" ]; }; }; diff --git a/modules/common/applications/nautilus.nix b/modules/common/applications/nautilus.nix index 4b8a142..ac11752 100644 --- a/modules/common/applications/nautilus.nix +++ b/modules/common/applications/nautilus.nix @@ -17,9 +17,11 @@ gnome.sushi # Quick preview with spacebar ]; - # Set default for opening directories - xdg.mimeApps.defaultApplications."inode/directory" = - [ "nautilus.desktop" ]; + xsession.windowManager.i3.config.keybindings = { + "${ + config.home-manager.users.${config.user}.xsession.windowManager.i3.config.modifier + }+n" = "exec --no-startup-id ${pkgs.gnome.nautilus}/bin/nautilus"; + }; programs.fish.functions = { qr = { @@ -27,8 +29,26 @@ "${pkgs.qrencode}/bin/qrencode $argv[1] -o /tmp/qr.png | ${pkgs.gnome.sushi}/bin/sushi /tmp/qr.png"; }; }; + + # Set default for opening directories + xdg.mimeApps = { + associations.added."inode/directory" = [ "org.gnome.Nautilus.desktop" ]; + # associations.removed = { + # "inode/directory" = [ "kitty-open.desktop" ]; + # }; + defaultApplications."inode/directory" = + lib.mkBefore [ "org.gnome.Nautilus.desktop" ]; + }; }; + # # Set default for opening directories + # xdg.mime = { + # addedAssociations."inode/directory" = [ "org.gnome.Nautilus.desktop" ]; + # removedAssociations = { "inode/directory" = [ "kitty-open.desktop" ]; }; + # defaultApplications."inode/directory" = + # lib.mkForce [ "org.gnome.Nautilus.desktop" ]; + # }; + }; } diff --git a/modules/common/neovim/default.nix b/modules/common/neovim/default.nix index dd9ca3a..03b1c89 100644 --- a/modules/common/neovim/default.nix +++ b/modules/common/neovim/default.nix @@ -38,8 +38,9 @@ in { name = "Neovim wrapper"; exec = "kitty nvim %F"; }; - xdg.mimeApps = lib.mkIf pkgs.stdenv.isLinux { - defaultApplications."text/markdown" = [ "nvim.desktop" ]; + xdg.mimeApps.defaultApplications = lib.mkIf pkgs.stdenv.isLinux { + "text/plain" = [ "nvim.desktop" ]; + "text/markdown" = [ "nvim.desktop" ]; }; };