Configure how xdg-open opens html files?

Additionally, the mime types x-scheme-handler/http and x-scheme-handler/https seem to decide what happens when I click/xdg-open a link - default-web-browser doesn’t appear to influence those.

Today I discovered an awesome alternative to xdg-open:

gio open

From nixpkgs.glib.

With gio open you can open whatever URI you have and you can configure mime types with gio mime. It works pretty reliably and I assume it integrates with Gnome’s default file opener etc.

2 Likes

It’s worth noting that gio open doesn’t follow the XDG spec. At some point I wasted a lot of time trying to work out some mime issue that bottomed out in the application using the non-compliant glib version.

Hello, I have a bit of code which, by my limited undestanding of nix, should work but I’m stuck at trying to modify mimeinfo.cache.

I cannot read the “current version” of mimeinfo.cache. I haven’t been able to spend more time on this but it seems like mimeinfo.cache isn’t even generated at this point?

Here’s my code so far- [WIP] nixos/open-with: init by SRGOM · Pull Request #88025 · NixOS/nixpkgs · GitHub does anybody have any insights on how to proceed from here.

Basically there are only two more steps:

  1. Actually read the current mimeinfo.cache
  2. Actually write it.

(probably 3): more packages in environment.systemPackages.

I would appreciate help here…

Thank you.

EDIT: Forgot link: [WIP] nixos/open-with: init by SRGOM · Pull Request #88025 · NixOS/nixpkgs · GitHub