I can set them in the control center but it seems the data is not saved in dconf. Where are they saved? Can I configure them declaratively?
Those are just plain XDG standard default MIME associations. You can set them with xdg.mime.defaultApplications
NixOS option or xdg.mimeApps.defaultApplications
home-manager option.
You can see what MIME types each category sets by looking at content-type
property in the g-c-c source (and types supported by the app, matching wildcards in the filters
property, see bellow). Just make sure you do not also have them set in ~/.config/mimeapps.list
since that file will have priority over the NixOS option.
I set some mimes in xdg.mime.defaultApplications
. I didn’t see any lines in /etc/xdg/mimeapps.list
from GNOME control center. Are they saved in another file? In the source code it sets some mime types with wildcard. So I can simply use something like image/*
in xdg.mime.defaultApplications
? I set different apps in GNOME control center and /etc/xdg/mimeapps.list
and the one set in the control center is used.
GNOME Control Center writes to your user’s associations (~/.config/mimeapps.list
by default).
The XDG specification currently does not support wildcards.
The filters
property lists wildcards for secondary MIME types. g-c-c will look at what MIME types the desktop file of selected application supports that match any of the wildcards and also sets the application as default handler for those:
Got it, thanks!
Oh, that’s too stateful. I can read the mime types from the desktop file so that I don’t need to list them one by one in my config file, but that requires IFD. Or I need to write a INI merger or run Nix in Nix.