Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

It's straightforward to set vlc as default using the GUI, but straightforward doesn't mean easy(I have to do the same thing over and over many times each time I install a new system). I just need a short command for this(e.g. set a gconf or dconf key). Please no answers like right-click and select Properties.

share|improve this question
add comment

2 Answers 2

You can set the default mimetype handler with the gvfs-mime command. Unfortunately, you need to do this for each mimetype. There's no way I know to set it for all video at once.

gvfs-mime --set video/mp4 vlc.desktop

You could of course script that.

#!/bin/bash

MIMETYPES="video/x-flv video/mp4 video/mpeg video/ogg video/x-theora+ogg"

for i in $MIMETYPES; do
   gvfs-mime --set $i vlc.desktop
done

To makesure you get all the mimetypes that Totem is set to handle, you could parse it's desktop file for the MIMETYPES variable like:

MIMETYPES=`cat /usr/share/applications/totem.desktop | grep "MimeType" | cut -d '=' -f 2 | tr ";" " "`
share|improve this answer
add comment

That information is stored in .local/share/applications/mimeapps.list, I save a copy of that file and copy it to new systems.

share|improve this answer
    
is there a better way of doing that? –  jrg Dec 8 '12 at 13:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.