May 31, 2008...12:59 pm

Changing default applications

Jump to Comments

In Ubuntu 8.04 it’s surprisingly hard to change default applications to something of your liking.

Sure you can right-click a mp3 file and set it to be open with the player of your choice, but that’s not enough.

What if you want dvd’s to be opened with vlc instead of totem? What if you want cd’s to be opened with exaile instead of rythmbox? If you search for files mp3’s get opened with totem,  … all these things can’t be changed with the provided GUI nor with “gconf-editor”.

I hope this will be “fixed” in the next Ubuntu release this October.

It’s been said that Ubuntu and Gnome tend to simplify things, and most of the time this is a good thing, just not this time.

The “preferred application” dialog is too basic and pretty useless, they should be able to do better in the next release.

I’m pointing out the obvious by saying Ubuntu is still Linux, and you can pretty much change every behavior the OS has as default.

Enough ranting, let’s see how to do it.

You’ll need to fire up the terminal (Applications -> Accessories) and copy/paste this code

gksudo gedit /etc/gnome/defaults.list

A prompt will ask for your password.

Gedit (a text editor) will open and you’ll see a lot of lines.

If you want to change what types of files should be opened with a application you prefer, look for these lines:

application/vnd.ms-excel=ooo-calc.desktop

I haven’t actually done this, but it should be as easy as replacing “ooo-calc” with the program you prefer. Let’s say you like gnumeric better, the line should read like this

application/vnd.ms-excel=gnumeric.desktop

The same logic can be applied to all other lines as well.

I’ll give some other examples (that I did test).

Letting a dvd open with vlc by default.

Change this line:

x-content/video-dvd=totem.desktop

to this

x-content/video-dvd=vlc.desktop

Let a mp3 file open with exaile (also when you search for them, …)

Change this line:

audio/x-mp3=totem.desktop

to

audio/x-mp3=exaile.desktop

Open a cd with exaile by default

Change this line

x-content/audio-player=rhythmbox.desktop

to this

x-content/audio-player=exaile.desktop

After you saved that file, go to “system -> preferences -> main menu”, expand sound and video, and on right side right click on vlc -> properties. Change the launcher command to

vlc %m

I don’t know exactly why this is needed (if you know, leave a comment) but exaile didn’t have %U after it and I didn’t put %m after it and it still worked.

It could be that this is needed for some programs.

source

12 Comments

  • Thank you. I also hope that they will make it more accessibly in the next version of Ubuntu :)

  • [...] Junho 2008 de Smaily Prado Acabei de entrar num blog do wordpress, chamado Linux Owns (donos de linux) e me deparei com a seguinte [...]

  • Thanks a lot. This was rather useful.

    Regards,
    chvnx

  • im not agree with your guide mate, you make it too difficult, just go to an mp3 application (for example) and go on properties, than you’ll have to go on Open with TAB and it will make you choose forever how to open the filetype

    beware: what i said its not just a “open with”

    ps: i did the same to my external hd to change permission by root owner to my principal user.

    this ubuntu seems to be much easier than normal, so that it was a little difficult to figure out how stupid settings are going to be done.

    cya mate, nice blog

  • Eh?

    Why don’t you just go into preferences in Nautilus and select the right most Tab and then you can set default programs for Camera/DVD/etc.

  • Because the preferences in nautilus are waaay to limited and don’t work properly.

    The mp3 and dvd instructions were just so people would know how to change things.

    There are hundreds of file types you can set default programs for.

  • @angelo: you don’t understand what he is trying to fix. read up.

    @the author: has this actually worked for you?
    I am experiencing problems with Firefox 3 (in Ubuntu8.04). When double clicking on a PDF in the Downloads window (after it has been downloaded) it automatically opens in evince.
    The funny thing is that my mime.types file and default.lists file already contain the AdobeReader.desktop section for application/pdf, so everything should be ok. The command xdg-mime query default application/pdf confirms it when outputting “/opt/Adobe/Reader8/Resource/Support/AdobeReader.desktop”. Don’t know of anything else I can do…

    As to you solution, it could be improved somewhat. You are changing this on a system wide basis, which really isn’t necessary. You also have per-user versions of the defaults.list file in .local/share/applications/defaults.list. Just the same. And strictly speaking you should use the xdg-mime command to change the settings. That way they will work in both KDE and Gnome (which that tool takes care of).

    But since (in my case) Firefox doesn’t respect these settings it really doesn’t matter …

  • [...] this link to find out how to do it [...]

  • @ Carl-Erik:

    Yes it worked for me.

    Well, the ones I tried.

    You have a point about the system wide settings.

    About the xdg-mime, I didn’t know that.

    Thanks.

  • I belive you could do all this using GUI. Just go to Nautilus:
    Edit -> Preferences -> Media (tab)

    Now you can choose some default options (like Totem, Rythmbox and so on) or use “Open With other application” (to choose your favorite one) or go for even a “Custom command” to do more complex stuff.

  • Using jaunty, tried to link pdf’s to acrobat reader instead of evince:

    - right click a pdf file
    - select ‘properties’
    - open ‘open with’ tab
    - select adobe acrobat

    from now on all pdf’s are opened with my preferred application. Guess this works the same for other applications/formats. Not sure if this is jaunty specific.


Leave a Reply