Tag: Trusty Tahr

Setting File Associations at the Command Line

I use Freemind, the FOSS mind-mapping software, as a thought capture and organisation tool. When I upgraded to Trusty Tahr 14.04 I forgot to re-install Freemind. I subsequently tried to open an existing mindmap file (a Freemind file with an extension of .mm) but it opened in gEdit, the default Ubuntu test editor.

Realising I hadn’t put Freemind back onto my desktop since the upgrade, I fired up the Software centre and installed Freemind. I double-clicked the .mm file again but it still opened in gEdit.

OK, looked like I needed to set the default application for the .mm file type. I right-clicked the .mm file and highlighted Open With in the context menu. Darn – Freemind wasn’t listed in the daughter menu.

Next step was to select the Other Application… option from the context menu. This allows you to select the default program from a list of installed applications. But Freemind wasn’t listed there either!

I did a bit of reading and found the mimeopen command, which saved the day.

I opened a terminal window, cd’d to the folder with the .mm file and executed:

mimeopen -d FirstOrderLogic.mm

I was presented with a text mode menu in the terminal:

Please choose a default application for files of type application/x-freemind

1) FreeMind (freemind)
2) LibreOffice Writer (libreoffice-writer)
3) Geany (geany)
4) gedit (gedit)
5) Other…

use application #

That was great – Freemind was listed in the menu. I entered the digit 1 as my response and pressed enter. Freemind was then fired up automatically and the file loaded.

From that point onwards the association between Freemind and .mm files was established, and double-clicking any .mm files invoked Freemind to correctly launch and open the target file.

Even if Freemind hadn’t been listed in the mimeopen menu, I could have used option 5 and then specified the application I wanted to use by name. In my case this would have been:

freemind %f

Where the %f represents a token which is replaced at run time by the name of the file on which you have double-clicked.

Tags : , ,