Am being so comfortable with VLC Media Player on Windows, I decided to use the same on Ubuntu Linux. But the problem was, whenever I try to browse a movie double-click on the file, it would open with the default Totem Movie Player. It seemed so simple to modify the file association and set out to give it a try just like in windows. And ofcourse this wasn't anywhere similar to the Windows registry stuff.
This irritated me for a couple of weeks, I knew it would be some stupid settings somewhere deep inside the folders which I just couldn't find. So, I set to find the answer.. After few days of internet research, this topic was created, so you don't need to waste time as I did.
This topic gives you an insight on which files are needed to be modified to change the system file associations. All the below listed modifications requires root access.
1) /usr/share/applications/defaults.list
This file contains the applications which cause a double-click success. All Mime types will point to a desktop file (A desktop file is nothing but an ascii file one for each application with some standard information about the application like category it belongs to, mime types it supports etc.,)
2) /usr/share/applications/[application_name].desktop
This is the file where "defaults.list" will point to. One of the most important things inside this file is the entry "MimeType=".
3) /usr/share/applications/mimeinfo.cache
Contains information in similar form shown for file "defaults.list" in same directory. This file contains ALL associations given to a mime type. There is no need for a specified order of desktop files.
4) /usr/share/mime (Directory)
This directory contains several information. The sub-directories - excluding packages - contain information about given mime types. You'll see that many mime types already exist.
5) /usr/share/mime/globs
This file contains the file extensions, associated to the mime-types.
Example: VLC Player should start .avi files by Double-Click
Creating the desktop file
If it is not already existing, create the file "/usr/share/applications/vlc.desktop" like this:
[Desktop Entry]
Name=VLC Movie Player
Comment=Play multimedia files and media
Icon=vlc
Exec=vlc %f
Terminal=false
MimeType=video/x-avi;video/x-msvideo;video/quicktime;video/x-ms-asf;video/x-ms-wmv
Type=Application
Categories=Application;AudioVideo;
Encoding=UTF-8
Modify defaults.list
This file will init our DEFAULT application. It ONLY contains ONE desktop file for EACH mime type:
video/x-msvideo=vlc.desktop
video/x-avi=vlc.desktop
Modify mimeinfo.cache
To take effect as default application and init the double-click feature, we need to modify the mimeinfo.cache also:
video/x-msvideo=vlc.desktop
video/x-avi=vlc.desktop
This file can use MORE then ONE desktop file. If you want to be able to handle - for example - avi files with different players, a line like this is also acceptable:
video/x-msvideo=vlc.desktop;totem.desktop
This will change the right-click-menu and insert Totem Movie Player, while vlc is still default (with double-click)
After modification, log out and log in again... and there you are all set.
You can get a much cleaner filetype association tool by ’sudo apt-get assogiate’.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment