13

In Ubuntu 11.04 I usually edit my *.fig files by clicking on the icons. The application (script) which opened the file was texfig. This script was chosen by "open with..." in nautilus. But now there is no possibilities to choose other applications than the predefined ones appropriate to the mimetype. How can I define a default application (or a self made script) in nautilus for the x-xfig mimetype?

1
  • i suggest you have set the executable bit? this is what always happens to me when i do scripts :)
    – Dominik
    Oct 25, 2011 at 22:25

6 Answers 6

13

You can create a .desktop file that will be listed on 'Open with other application' tab:

  • Navigate to ~/.local/share/applications
  • Create a file called textfig.desktop with these contents:
[Desktop Entry]
Encoding=UTF-8
Name=Textfig
Comment=Edit fig files using custom textfig script
Exec=<path to your script> %u
Terminal=true
Type=Application
Icon=
Categories=Application;Utility;TextEditor;
StartupNotify=true
MimeType=text/plain;
NoDisplay=true

After this you will see Textfig in your Open with other application tab, select it and when you double click the file you will be able to open it using your program.

Just adjust the rest of the values a bit more to fit your needs. The %u will tell nautilus to execute it on the currently selected file.

1
  • You will need to fix up the MimeType and other settings to match the file types you want to associate. Also, you will probably need to restart Nautilus (try typing nautilus -q in a command line to quit, then open it again).
    – user29020
    Nov 14, 2014 at 17:55
6

For the less technical advanced users you can do this:

  1. Install the Thunar file manager from Xfce desktop environment (it will only install thunar, not the rest of xfce4):

    sudo apt-get install thunar
    

    (Alternatively, you can install the thunar package in the Ubuntu Software Center or the Synaptic Package Manager.)

  2. Open thunar in the Terminal or through the applications menu / GNOME Shell / Unity / whatever and then use the Thunar file manager to set your filetype associations. Nautilus will respect these associations, too, the next time you click on that filetype in Nautilus.

2

If you're more GUI minded (like me), go to launchpad PPA and install Ubuntu-Tweak into your software repositories. As far as I and many others are concerned, it should be included in all distribution installation packages.

One of the 'tweaks' is Nautilus, where you can change your file associations as before, including anything in usr/bin.

Check it out at http://ubuntu-tweak.com/.

2

You need to specify a *.desktop file , place the file type you wanted to open.

Firstly you need to get the mimetype of that file , e.g *.mkv

use: mimetype /path/to/file to find it out

XXXX.mkv:                      video/x-matroska

Now you modify default assosiated application , in ~/.local/share/applications/mimeapps.list , create one if not found.

Merge the following to that file:

[Default Applications]
video/x-matroska=mplayer.desktop;

This means you use mplayer.desktop to open all *.mkv files by default. (Create mplayer.desktop in /usr/share/applications, and point Exec= to you script`

mplayer.desktop:

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Exec=mplayer -ao alsa %f
Name=MPlayer
NoDisplay=true
Icon=gnome-mplayer
1

I have cooked this little script to allow our users to open a file with a program of their choice.

https://github.com/gecos-team/openwith

0
  1. Select the file that you want to change.

  2. Choose File ▸ Properties. The properties window for the item is displayed.

  3. Click on the Open with tab.

  4. Select which application do you like to open that type of files.

Source

1
  • 1
    well, now I see that you can't add an application there either... bummer
    – Jens
    Feb 29, 2012 at 14:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .