Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for launching *.drawio files when used in Ubuntu via snap #363

Closed
thekalinga opened this issue Aug 20, 2020 · 4 comments
Closed
Labels

Comments

@thekalinga
Copy link

thekalinga commented Aug 20, 2020

Currently if drawio is installed via snapstore, I am unable to launch application by double clicking on the *.drawio file in file explorer. By default ubuntu is considering drawio as text file. This seems to be due the fact that application/vnd.jgraph.mxfile is an unknown mime type in ubuntu.

Would make user's life much simpler if the application delivered via snap allows user to do this


Here is how I fixed the issue in my own Ubuntu 16.04 system

  1. Created a file at ~/.local/share/mime/packages/drawio.xml with the following content
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
    <mime-type type="application/vnd.jgraph.mxfile">
        <comment>Drawio Diagram</comment>
        <glob pattern="*.drawio" case-sensitive="true"/>
    </mime-type>
</mime-info>

This seems to be the way we make a new mime type available to ubuntu

  1. Update ubuntu mime-database by running update-mime-database ~/.local/share/mime

  2. Copy drawio icon to ~/.local/share/icons/application-vnd.jgraph.mxfile.png from /snap/drawio/current/meta/gui/icon.png

i.e I ran cp /snap/drawio/current/meta/gui/icon.png ~/.local/share/icons/application-vnd.jgraph.mxfile.png

(In case of snap, I see the following directory /var/lib/snapd/desktop/icons. Not sure if the icon needs to be copied here as part of snap installation)

  1. Update ubuntu icon cache so file manager knows that icon exists update-icon-caches ~/.local/share/icons/

Now all drawio files show icon & also I'm able to right click & associate *.drawio files with Drawio application without affecting the default application for rest of the text files using Files application

Extra notes:

I ran gvfs-info test.drawio/gio test.drawio & looked at standard::icon row in the output.

The row looked like the following

standard::icon: application-vnd.jgraph.mxfile, application-x-generic

The 1st icon name application-vnd.jgraph.mxfile is the name of png file ubuntu looks for. If its not found, it uses application-x-generic.png as the image as fallback. Once I placed under ~/.local/share/icons/application-vnd.jgraph.mxfile.png, all file icons for *.drawio in the file system show drawio icon. The icon preferred for this 128x128 resolution, but even 1024x1024 (default) also seem to work fine

Someone said elsewhere (I have not tried), we can use /usr/share/mime/packages for mime file xml & /usr/share/icons/ for icon update if we want to do it at system level instead of user level

@stale
Copy link

stale bot commented Dec 7, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. See the FAQ for more information.

@stale stale bot added the wontfix label Dec 7, 2020
@stale stale bot closed this as completed Dec 10, 2020
@cfsanchezMinsait
Copy link

Just an update. With Ubuntu 20.04 (I don't know if the version is relevant), I had to copy the file ~/.local/share/mime/packages/drawio.xml also in the path ~/.local/share/mime/application/drawio.xml. I followed all the other steps indicated by @thekalinga, and it worked for me.

@brlin-tw
Copy link

brlin-tw commented Oct 18, 2021

Hello, this affects greatly to GNU/Linux users' UX as currently opening the file will launch the default text editor due to its MIME file type has been incorrectly classified as text/plain, please reopen this issue.

Screenshot depicting current situation

@brlin-tw
Copy link

Related with #11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants