ComputersIntegrating a new application in Gnome

part of the screenshot defining the new application as defaultJust found out that the task of adding a new application for a new file-type on gnome (so that I can run it by double click, or from the mail client on an attachment, is easier than I suspected.

The problem: my bank send me my account information in files that are managed by an application that they supply. It’s a MS Windows application, but fortunately most of it runs ok under wine. The files are zip files, with a custom extension *.fm6.

The first step is to make gnome aware that .fm6 files are different from zip files, and are to be treated differently. That is called “adding a MIME type” to the system. To do so, I added a file, called fastm6.xml, in $HOME/.local/share/mime/packages/, and then issued the command

update-mime-database $HOME/.local/share/mime

Content of the $HOME/.local/share/mime/packages/fastm6.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/x-fastm6">
<glob pattern="*.fm6"/>
<comment>Caja de Ingenieros files</comment>
</mime-type>
</mime-info>

To add an icon for the new mime type, simply drop a png file (size 48×48) into $HOME/.local/share/icons called application-x-fastm6.png. Refresh your nautilus windows and voilà, you have them.

Now you can right click on the icons can choose the application you want to run for them (“open with another application” and the enter it as a default). In my case it was a shell script like that:

#!/bin/bash
#
fastdir=$HOME/.wine/dosdevices/c:/FAST/FASTM6
cp $1 $fastdir
cd $fastdir
wine c:/FAST/FASTM6/fastm6.exe $(basename $1)

but you mileage may, obviously, vary.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

  

  

  

This site uses Akismet to reduce spam. Learn how your comment data is processed.