Associating File with an Application in Gnome 3

I have installed a program…

Login

Blog History

I have installed a program named OCRFeeder to be handle using tesseract.

OCRFeeder saves files with a .ocrf extension of application/zip mime-type.

By default you associate mime-types to applications the problem is the OCRFeeder files are recognized as application/zip files and associating OCRFeeder with all application/zip files would a problem.

How to Create a Specific mime-type to File Extension

If you want to associate a specific extension to an application see http://oxygene.sk/lukas/2010/09/custom-file-associations-on-gnome/

<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
  <mime-type type="application/x-ocrfeeder">
    <glob pattern="*.ocrf"/>
    <comment>OCRFeeder File</comment>
  </mime-type>
</mime-info>

How to Associate Files with a Program in Gnome 3

First you right click on the file and choose properties

You then click the Open With tab of the properties dialog

Click the "Show other applications" button and scroll to select the Application you want to open the file with... Except in my case OCRFeeder is missing from the list:

How to get an Application to show up in the Open With List

make sure the Gnome Menu Editor alacarte is installed. If it isn't on Fedora run

yum install alacarte

Once installed run alacarte and find your application (If your application is missing from the menu you may need to add it. This is not covered in this post)

Select the Application and click the Properties button. Here you can see the Command field is "ocrfeeder" only

You need to change the Command field to be "program_name %U" (Capital U) in this case ocrfeeder %U

Once you make the above change you can then go back into Nautilus (The Gnome 3 File Manager) and right click on the file, choose properties, open with, show other applications, scroll to find your application and click Set As Default

 

 

Note: The above mentioned procedure will only work if your program will take the file you want to open as an argument. Ironically after doing all the above for OCRFeeder it wouldn't work because apparently OCRFeeder doesn't take an ocrf file as an argument:

Usage: ocrfeeder [options]

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -i IMAGE1 [IMAGE2, ...], --images=IMAGE1 [IMAGE2, ...]
                        images to be automatically added on start-up. Use the
                        option before every image path.
  -d DIRECTORY, --dir=DIRECTORY
                        directory with images to be added automatically on
                        start-up

 

 

 

 

 

1 Comment

  1. isaac

    You save me

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.