Linux Associate file icon and application

I could not get association of a file icon, mime type and application to work satisfactorily. There are numerous how-tos on the Internet but all are incomplete or wrong. The greatest help, for me, was the ARCH Linux Default applications help page. It helped more than any other, but wasn’t all of what I needed. BTW, I couldn’t get the icon to work in the .local directory so I had to put it into ‘/usr/share/icons/Mint-X/mimetypes/scalable/’ in my Mint 17.2 system.

Anyway, I wrote up a cheat sheet for me using the freerouting java program as my example. Here it is:

Example - add file icon and application for freerouting in ~/bin

Place inkscape created icon.svg in:
/usr/share/icons/Mint-X/mimetypes/scalable/

In ~/.local/share/mime/packages/ place application-x-specctra-dsn.xml:
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
  <mime-type type="application/x-specctra-dsn">
    <glob pattern="*.dsn"/>
    <glob pattern="*.DSN"/>
    <comment>SPECCTRA DSN for autorouters</comment>
    <icon name="application-x-specctra-dsn"/>
  </mime-type>
</mime-info>

In ~/.local/share/applications/ place file freerouter.desktop
[Desktop Entry]
Version=1.0.0
Encoding=UTF-8
Name=freerouter
GenericName=freerouter
Comment=freerouter Autorouter for pcb
Exec=/home/username/bin/freerouting
Icon=application-x-specctra-dsn
StartupNotify=true
Type=Application
MimeType=application/x-specctra-dsn;

Enter:
sudo gtk-update-icon-cache /usr/share/icons/Mint-X/
sudo update-desktop-database

NOTE: In this example "/home/username/bin/freerouting" is a shell command:
#!/bin/bash
java -jar /home/username/bin/FreeRouting/fr.jar

It executes a java program
<span
data-mce-type="bookmark"
id="mce_SELREST_start"
data-mce-style="overflow:hidden;line-height:0"
style="overflow:hidden;line-height:0"</span>
Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s