but listing them all like this is a bit of a pain.
Can I set an app as the default for all subtypes under a top-level? I tried with image/*, hoping this would encompass all the other image types, but it doesnât seem to work.
I had the same problem with Calibre after setting home-managerâs xdg.mimeApps.enable option.
It was annoying that MS Word docs got added to my Calibre library when I clicked on them. Perhaps worse though, Calibreâs ebook âviewerâ was modifying my EPUB files.
Rather than trying to fix the multitude of mime types that Calibre needlessly registers associations with, my approach was to delete .desktop files from the Calibre package.
However, such an override requires rebuilding Calibre. So, in my NixOS configuration, I added this:
{ pkgs, ... }: {
environment.systemPackages = with pkgs; [
calibre
# desktop launcher for calibre - minus file associations
(pkgs.runCommandLocal "calibre.desktop" { inherit (pkgs) calibre; } ''
mkdir -p $out/share/applications
sed -e '/^MimeType/d' \
$calibre/share/applications/calibre-gui.desktop \
> $out/share/applications/calibre.desktop
'')
# a better reader for epubs
foliate
];
environment.pathsToDelete = map (junk: "/share/applications/calibre-${junk}.desktop") [
"ebook-edit"
"ebook-viewer"
"lrfviewer"
"gui"
];
}
It would be nice to have a better solution though. I find home-managerâs xdg.mimeApps rather tricky to use. And also I lack a good method for tweaking application desktop launchers.