drawio-desktop
drawio-desktop copied to clipboard
File associations in MacOS
- [x] I agree to follow the Code of Conduct that this project adheres to.
- [x] I have searched the issue tracker for a feature request that matches the one I want to file, without success.
Is your feature request related to a problem? Please describe. Many times when I'm working on a project with a number of different file types that are all usually stored in the same folder. I'd like to open a draw.io diagram from Finder (or Explorer if I was in windows). The current workflow I use is kind of awkward and unintuitive. See below for the workarounds I've been using today.
As a context item, I store a lot of my diagrams as .png files so that others who don't have draw.io can at least view them. It also provides a preview of the diagram in many cases, which is a great convenience. So my feature request revolves around two things 1) ability to preview for people who don't use draw.io 2) Finder/Explorer ability to open a PNG directly into draw.io without jumping through too many hoops. Hitting a single "Open With" menu for me is an acceptable
Describe the solution you'd like I would like the draw.io application to somehow advertise to macOS that it is capable of opening .png/.xml files. Even if I choose not to open every PNG file, it can at least show up in the "Open With" dialog in macOS.
Describe alternatives you've considered These are more work-arounds:
- I open a new window of draw.io, and click/drag the file into it. If I forget to open a new document first, it just inserts the image into my existing diagram, which is a frustrating experience.
- I go into the File/Open dialog in draw.io and have to navigate to the same folder that I have open in another window
- I just use "open with", "other", change "recommended applications" to "all applications", and scroll around until I find draw.io
Other solutions that could possibly work (may require some experimentations):
- Investigate if OS's can support double extensions, IE:
.drawio.png
Additional context
This is the typical Open With dialog. I'd like it if I can make draw.io appear in there.

This is what happens when I select "Other applications".

Digging around in stackexchange, I found this work-around for a different application, but I fully expect any changes I make to be overwritten as soon as draw.io upgrades:
- https://apple.stackexchange.com/questions/131583/adding-to-open-with-list
So, an example PR was closed because making drawing able to open a png via Finder would be too confusing. Are there any alternative ideas?
I have a workaround solution for this. I created an Application using Automator that opens draw.io or Preview based on the double file extension. Then I associated .png files with the Application. You can simply double-click the .png file (or many .png files) and the correct app will open. Here's steps to do that:
- Open Automator and create a new Application.
- Add a "Run Shell Script" step
- Change "shell" to "/bin/bash" and set "Pass input" to "as arguments"
- Paste the script below.
- Save the Application to your Applications folder.
- Right-click on a .png file, click Get Info.
- In the "Open With..." dropdown, choose "Other..." and then choose the new Application.
- Click "Change all..." to associate all .png files with the new Application.
The script:
for FILENAME in "${@:1}"; do
if [[ "$FILENAME" == *drawio.png ]]; then
open -a draw.io "$FILENAME"
else
open -a Preview "$FILENAME"
fi
done
I think that workaround is good enough. Associating with .png on install is a step too far for me.