Welcome to yEd Q&A!
Here you can ask questions and receive answers from other members of the community and yEd developers. And you can tell us your most wanted feature requests.

Categories

Associate yEd application with .graphml files on Linux

+2 votes

On Linux, yEd installs a .desktop file for itself (great!) but it leaves out the MimeType line and the associated steps needed to allow .graphml files to open with yEd (e.g. when double clicked in a file browser or when opened with xdg-open).

The installer should create a new MIME type named application/graphml+xml using:

xdg-icon-resource install ...
xdg-mime install ...

See insttructions here:

http://stackoverflow.com/a/31836/471839

in Feature Requests by (150 points)

2 Answers

0 votes
just add a %f to the desktop file and in a good file browser you can change the default application associated with this mime type...
by
Unless the yEd installer teaches the system about a new MIME type, then they will just be treated as plain XML so manually changing the application that opens the file through file browser settings will result in all XML files being opened with yEd.

Furthermore, this would only work when opening the file in that particular file browser not, for example, if you downloaded a .graphml file using a web browser and tried to open the file directly from there.
0 votes

While waiting yWorks to implement the .graphml association you can you the script below to do it yourself. Save and run the script from you yEd installation directory root.

The code below is also in Gist:

#! /bin/bash

 
# Run the script in the root of yEd installation directory
# Tested with Ubuntu 18.04
 
# Create a new mime type definition file
cat >graphml+xml-mime.xml << EOL
<?xml version="1.0"?>
   <mime-type type="application/x-graphml+xml">  
   <comment>yEd graphml file (xml format)</comment>
   <glob pattern="*.graphml"/>
   <generic-icon name="x-application-graphml+xml"/>
  </mime-type>
 </mime-info>
EOL
 
# Install the new mime definition
sudo xdg-mime install graphml+xml-mime.xml
 
# Install icon (size 48 can be extracted from i4j_extf_2_1aawyej_k3n8ea.ico file)
sudo xdg-icon-resource install --context mimetypes --size 32 .install4j/yEd.png x-application-graphml+xml
 
# Append %F to yEd .desktop file so it is visible in "Open With Other Application" menu
sed -i '/Exec/ s/$/ %F/' ~/.local/share/applications/yEd\ Graph\ Editor-0.desktop
 
# Finally go to file manager, right click, select "Open With Other Application",
# click "View All Applications" and select yEd.
by (160 points)
Legal Disclosure | Privacy Policy
...