Changing File Association for applications not shown in list

Questions about applications and software
Forum rules
Before you post please read this

Changing File Association for applications not shown in list

Postby mdwolfe on Thu Dec 29, 2011 5:10 am


My first post so please be gentle. I have upgraded to Mint 12 (32 bit) recently and have my system running well. However I have come across a number of occasions when I would like to associate a file type with an application but the application is not available in selectable list (right click file, Open With Tab, Show Other Applications button). On previous releases I thought there was a Browse facility to search for the appropriate application on the system but this appears to have been removed. Currently I am trying to associate a Gambas executable with the Gambas application but having no luck.

Any help would be greatly appreciated. :D
Level 1
Level 1
Posts: 5
Joined: Fri Jul 02, 2010 2:32 pm

Linux Mint is funded by ads and donations.

Re: Changing File Association for applications not shown in

Postby viking777 on Thu Dec 29, 2011 2:33 pm

Hi mdwolfe. I will try and answer this question but if succeed it will be a minor miracle, firstly because before I read your post I had never even heard of gambas, and that doesn't make troubleshooting any easier, and secondly because you are saddled with that hopeless piece of garbage that the gnome project seem to think is an acceptable file manager - Nautilus.

However here goes with my best shot. I apologise profusely that this is so ridiculously difficult when it should be ridiculously easy - although maybe someone else will come up with a better way.

Do you have a file called /usr/share/applications/gambas or /gambas.desktop? If you don't have a look in ~/.local/share/applications instead and see if it is there. If you don't have one in either location skip the next few instructions, I have tried to deal with that eventuality further down the page.

If you do have the desktop file in one of those locations then that is a start at least. You wont be able to open it because Nautilus is too dumb to let you, it will only run it. If you had a decent file manager as I do, you would be able to open it but sadly you don't because you haven't been given one, and that really is pretty shocking in itself, and in no way your fault. So we have to go about it another way.

Continuing to look in that same location/s look for a folder called /usr/share/applications/mimeinfo.cache, or ~/.local/share/applications/mimeapps.list this is where the list of file type associations is kept. You will need to modify this with a text editor (and if your gambas desktop file is in /usr/share/xxxxxx you will need to have sudo privileges to do this, so - sudo gedit - ) for the ~/.local/xxxxx location you wont need sudo.

You need to add to one or other of these files a couple of lines line like this:

Code: Select all

Now I must add here that those mime types are ones that I have been able to glean by going online and searching, they may not be the only two that you need, I don't know as I don't use gambas you may have to research this further if those two alone don't work.

So, what if you don't have a 'gambas' desktop file in either location?

Answer, you have to write one yourself. It is only a text file so you just right click on one of the locations above and select 'Create new document'/Empty Document. After that what you put in will look something like this:

Code: Select all

Then save it as gambas.desktop.

I cannot stress strongly enough that almost every entry that I have written in that file is guesswork and MUST be verified by you first (you can't do any damage by writing it as I have written it, but it more than likely wont work). I repeat I know nothing about this program and so cannot possibly write a correct desktop file for this program.

And that is all it is :shock:

I really hope for your sake that somebody else comes up with a better way :)

Good luck.
Fujitsu Lifebook AH532. Intel i5 processor, 6Gb ram, Intel HD3000 graphics, Intel Audio/wifi. Realtek RTL8111/8168B Ethernet.Lubuntu 13.10,Ubuntu12.10 (Unity), Mint16 (Cinnamon), Manjaro (Xfce).
User avatar
Level 14
Level 14
Posts: 5153
Joined: Mon Dec 01, 2008 11:21 am

Re: Changing File Association for applications not shown in

Postby mdwolfe on Sun Jan 08, 2012 8:25 am

Wow thanks Viking77 for your detailed reply. You gave me all the tools I needed to find the solution :D .

Here's what I found and the solution I came up with based on your info:-

Gambas has a separate BIN that runs scripts as an application called GBR2. By running 'gbr2 applicationname.gambas' from the terminal, the script would run as I required. Once I knew this I added a file '/usr/share/applications/gambas2executable.desktop' as you had advised, as shown below:-

Code: Select all
[Desktop Entry]
Name=Gambas2 Executable
Name[es_ES]=Gambas2 Executable
Comment=Gambas Almost Means Basic
Comment[es_ES]=Gambas es parecido a Basic Visual

I then added the following to '/usr/share/applications/mimeinfo.cache' :-

Code: Select all

This fixed my problem. As you quite rightly say, it should never be this difficult, but all the time there are helpful people like yourself around willing to share their knowledge we can all carry on enjoying the Linux experience.

Thanks once again and a Happy New Year to you.
Level 1
Level 1
Posts: 5
Joined: Fri Jul 02, 2010 2:32 pm

Return to Software & Applications

Who is online

Users browsing this forum: crooney, Google Adsense [Bot], karlchen and 27 guests