Handling of MIME types

Hi there,
I have successfully created a .desktop file for my snapped application (brynhild) and it shows up correctly in the start menu etc:

apps:
brynhild:
command: bin/desktop-launch $SNAP/brynhild
desktop: desktop/volsung-brynhild.desktop

This is how the desktop file looks like:
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
Exec=brynhild %F
Name=Brynhild
Icon=brynhild-icon
Categories=Geothermal;
MimeType=application/x-brynhild;

Question: There is currently no reference to the file brynhild.xml which defines my MimeType in the snapcraft.yaml file. How would I reference it correctly so that the snapped volsung.brynhild application associates with it?

AFAIK this is not possible from within your snap, or when installing your snap. However, just because you are using a snap shouldn’t mean users are prevented from accessing basic functionality. The trick is to ask the user to run a post-install script manually. Here is an example of how I have implemented this: https://snapcraft.io/kaffelogic-studio

The post install script looks like this

    echo Installing mime types for .ext1 and .ext2
    cp /snap/mysnap/current/opt/mysnap/mysnap.xml /usr/share/mime/packages
    update-mime-database /usr/share/mime