Skip to content

Submit AppImage MIME Type to xdg/shared-mime-info #144

Closed

Description

@elvisangelaccio

Hi,
do you have any plan about getting an "official" mimetype for .appimage files? Currently they are detected as executable files by the shared-mime-info database, which is fine. However there are use cases where a dedicated mimetype would be handy. For example, users of archiving tools like KDE's Ark or Gnome's file-roller may be interested in browsing the content of an appimage: https://bugs.kde.org/show_bug.cgi?id=363209

This new mimetype could inherit the application/x-executable mimetype, to express that appdata files are still executable files but they are also something more - e.g. they can be browsed with archiving tools.

Activity

  1. probonopd commented on May 18, 2016

    @probonopd
    Member

    Good point. Actually I have tried but never was successful; do you know why the following is not working?

    <?xml version="1.0"?>
    <mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
      <mime-type type="application/x-appimage; version=1.0">
        <sub-class-of type="application/x-executable"/>
        <sub-class-of type="application/x-iso9660-image"/>
        <comment>AppImage</comment>
        <magic priority="50">
           <match value="ELF" type="string" offset="1">
           <match value="CD001" type="string" offset="32769">
           <match value="AppImage" type="string" offset="32809"/>
        </magic>
        <magic priority="40">
           <match value="ELF" type="string" offset="1">
           <match value="CD001" type="string" offset="32769">
           <match value="APPIMAGE" type="string" offset="32809"/>
        </magic>
        <glob pattern="*.appimage"/>
        <glob pattern="*.AppImage"/>
      </mime-type>
    </mime-info>
    
    sudo xdg-mime install --mode system appimagekit-appimage.xml
    xdg-mime query filetype '/home/me/Downloads/test'
    # always returns:
    # application/x-executable
    
  2. elvisangelaccio commented on May 18, 2016

    @elvisangelaccio
    Author

    @probonopd
    Some of the <match> tags are not properly ended. You can check whether the installed XML is ok by running:

    sudo update-mime-database /usr/share/mime
    

    I was able to get the expected mimetype after fixing the above issues!

  3. probonopd commented on May 18, 2016

    @probonopd
    Member

    Strange. Changed it to

    <?xml version="1.0" encoding="UTF-8"?>
    <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
       <mime-type type="application/x-appimage; version=1.0">
          <sub-class-of type="application/x-executable" />
          <sub-class-of type="application/x-iso9660-image" />
          <comment>AppImage</comment>
          <magic priority="50">
             <match value="ELF" type="string" offset="1" />
             <match value="CD001" type="string" offset="32769" />
             <match value="AppImage" type="string" offset="32809" />
          </magic>
          <magic priority="40">
             <match value="ELF" type="string" offset="1" />
             <match value="CD001" type="string" offset="32769" />
             <match value="APPIMAGE" type="string" offset="32809" />
          </magic>
          <glob pattern="*.appimage" />
          <glob pattern="*.AppImage" />
       </mime-type>
    </mime-info>
    

    I get no more syntax complaints but it doesn't seem to work either. Ubuntu 16.04.

  4. elvisangelaccio commented on May 18, 2016

    @elvisangelaccio
    Author

    No idea, works for me (even your updated version). I'm on archlinux with shared-mime-info 1.6

    Anyway, when you submit a new mime to upstream shared-mime-info, they require you to provide a test file as well, and that is what matters. If the test passes, the mime is gonna be accepted :)

  5. probonopd commented on May 18, 2016

    @probonopd
    Member

    Anyone, we need to iron this out and then submit together with a link to an example AppImage such as https://bintray.com/probono/AppImages/download_file?file_path=Leafpad-0.8.17-x86_64.AppImage according to https://cgit.freedesktop.org/xdg/shared-mime-info/tree/HACKING. I'm a bit lost here.

  6. changed the title [-]Dedicated mimetype for .appimage files?[/-] [+]Submit AppImage MIME Type to xdg/shared-mime-info[/+] on May 18, 2016
  7. elvisangelaccio commented on May 18, 2016

    @elvisangelaccio
    Author

    I can do it if you want, I recently submitted a mimetype so I have fresh memory of the burocracy :p

  8. probonopd commented on May 18, 2016

    @probonopd
    Member

    That would be great. Before you do please check that it works with and without the suffixes.

  9. probonopd commented on May 18, 2016

    @probonopd
    Member

    ...and that the AppImage can still be executed by double-clicking when chmod a+x is set. Worst case would be that it is no longer recognized as an ELF executable in GNOME Nautilus and the likes.

  10. probonopd commented on May 18, 2016

    @probonopd
    Member

    Would making it a subclass of ISO automatically allow tools like Ark or file-roller to process it?

  11. elvisangelaccio commented on May 18, 2016

    @elvisangelaccio
    Author

    Would making it a subclass of ISO automatically allow tools like Ark or file-roller to process it?

    Not necessarily. I can only speak for Ark, which unfortunately hardcodes the list of supported mimetypes

  12. probonopd commented on May 18, 2016

    @probonopd
    Member

    For whatever reason I had to log out and log in again and now it is working. AppImages still run when they have the executable bit set; however when the executable bit is not set they are tried to be opened with file-roller (which says it cannot handle the file). Is there a way around that?

  13. elvisangelaccio commented on May 18, 2016

    @elvisangelaccio
    Author

    Yeah, same here with Dolphin+Ark. I guess they are indeed detected as ISO by the file-managers.

    What should be the expected behavior instead? Just nothing happening?

  14. elvisangelaccio commented on May 18, 2016

    @elvisangelaccio
    Author

    Another thing, the 2nd and 3rd magic offset are too big and I think the shared-mime-info maintainers will complain about this. Isn't enough to just match the ELF string?

  15. probonopd commented on May 18, 2016

    @probonopd
    Member

    Yeah, same here with Dolphin+Ark. I guess they are indeed detected as ISO by the file-managers. What should be the expected behavior instead? Just nothing happening?

    When we don't subclass it to application/x-iso9660-image, then it doesn't try to open the AppImage with file-roller. GNOME then asks "There is no application installed for “AppImage” files. Do you want to search for an application to open this file?".

    I am actually not sure which behavior is better. Just found out that when we subclass it to application/x-iso9660-image, then in GNOME I can right-click to open with gnome-disk-image-mounter which conveniently mounts the AppImage. Not bad... I guess we need to test the behavior under multiple *DEs.

  16. 68 remaining items

  17. elvisangelaccio commented on Jun 6, 2017

    @elvisangelaccio
    Author

    @probonopd Not yet, I just pinged the freedesktop guy on the bugzilla ticket...

  18. elvisangelaccio commented on Jun 6, 2017

    @elvisangelaccio
    Author

    @probonopd Oh, that was quick. Please let me know what do you think about https://bugs.freedesktop.org/show_bug.cgi?id=100608#c4

  19. TheAssassin commented on Jun 6, 2017

    @TheAssassin
    Member

    Looks like you're suggesting vnd.appimage as the MIME type for v2. That doesn't sound like a great idea, since there are going to be future versions of the AppImage specification You should rather introduce some versioned type, e.g. appimage.type2.

    The benefit of being able to distinguish between different types of AppImages for end user applications is so they can perform integrations like displaying the icon etc. which is a significantly different operation for different types of AppImages.

  20. probonopd commented on Jun 6, 2017

    @probonopd
    Member

    Could we not remove the type specific sub-class-of, add application/x-iso9660-appimage as an alias of the more generic application/vnd.appimage, and add the magic to the first type as well?

    Type 1 uses ISO9660 whereas type 2 is an entirely different format. They are described in the AppImageSpec.

  21. elvisangelaccio commented on Jun 6, 2017

    @elvisangelaccio
    Author

    What about future versions of the spec (as pointed out by @TheAssassin)? Are we going to need a new mimetype every time?

  22. probonopd commented on Jun 6, 2017

    @probonopd
    Member

    Yes, but we are not foreseeing changes to the spec that would require a type 3 for a very long time, since the type 2 spec is quite generic.

  23. probonopd commented on Sep 8, 2017

    @probonopd
    Member

    Thank you @elvisangelaccio.

  24. TheAssassin commented on Nov 23, 2017

    @TheAssassin
    Member

    Thanks @elvisangelaccio. I think I can close it safely now.

  25. probonopd commented on Jul 19, 2018

    @probonopd
    Member

    What does "vnd" mean?

    Can we explain what is going on here?

  26. TheAssassin commented on Jul 19, 2018

    @TheAssassin
    Member

    @probonopd vnd seems to be used by the XDG folks for all "containerized" applications.

  27. probonopd commented on Jul 19, 2018

    @probonopd
    Member

    ZOMG. AppImages are not "containerized", are they?

  28. TheAssassin commented on Jul 19, 2018

    @TheAssassin
    Member
  29. probonopd commented on Jul 19, 2018

    @probonopd
    Member

    vnd indicates vendor-specific MIME types, which means they are MIME types that were introduced by corporate bodies rather than e.g. an Internet consortium.

    Heh, so we are a "corporate body" now. Well, we are not an "Internet consortium" I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions