‘Unity’ desktop comes with a utility that lets us set the default application for opening certain file types. For example, by using this tool, one can change the default Web browser, Text editor, Image viewer, Audio player, Video player etc.Now most programs, while installing, if they are related to one of those available categories, they automatically add themselves, and thus, we can easily make them the default application for opening those file types. However, this does not always work.For example, when installing, ‘mplayer’ (the command-line based one) does not add itself to this list. This is understandable, as it is a command-line based one and most users won’t be using as the default media player.Nevertheless, by using a simple trick, one can easily add ‘mplayer’, or any other player that does not add itself into this list. In this article, I’m concentrating on adding a new program for handling audio/video categories only.Step 1:In Unity (including ), applications that have desktop or menu entries, rely on a configuration file, , for achieving that.Now as you know, the default media player in Ubuntu is called ‘Totem”. And by using its existing desktop entry file, called ‘totem.desktop’ (stored in ‘/usr/share/applications’), I have created a custom desktop entry file, that can be used to add any media player into the default application list for
formats.In other words, you can use this file to set a desired application as the default one for opening all the audio/video files, easily.So, first of all, download the configuration file from
(it is compressed, once the download completes, make sure to extract the file into your ‘Home’ folder).Step 2:Now open ‘Gedit’ text editor and open the extracted file (‘custom-media-player.desktop’) using it.Step 3:Now all you have to do is;1: Give a name under the ‘‘ field. You can enter any name here (it does not have to be the name of the program), and it will be used as the entry name listed on the ‘Default Applications’ (the tool that lets us change the default applications) menu.2: Under the ‘‘ field, enter the command of the program, do not change the ‘ argument.For example, if I wanted to execute ‘mplayer’, then I’ll replace the ‘enter-the-exact-name-here’ text field with ‘mplayer’ and the output will look like below.mplayer
3: If you want an icon to be displaced on the menu entry, then simply enter its path under the ‘‘ field, or else, leave it blank.When you are done, make sure to save the changes and then close the editor.Step 4:Now, assuming the file is in your ‘Home’ folder, enter the below command to move it into the ‘/usr/share/applications’ folder.sudo mv custom-media-player.desktop /usr/share/applicationsFor the newly added ‘desktop entry’ to be added into the ‘Default Applications’ utility, we have to update the ‘desktop entry cache’. For that, use the below command.sudo update-desktop-databaseThat is it.Note: You can open-up the ‘Default Applications’ dialog box by going over to: ‘System Settings’ -> ‘Details’ — ‘Default Applications’ (once this is clicked, you should see your newly added program under the drop-down list of ‘Audio’ and ‘Video’ options).Related Posts
An RHCE, ‘Linux’ user with 14+ years of experience. Extreme lover of Linux and FOSS. He is passionate to test every Linux distribution & compare with the previous release to write in-depth articles to help the FOSS community.Hi Gayan,I feel I must point out that the ultimate os, AntiX, comes with a program to make and install desktop files. As AntiX started from Mepis, I assume Mepis does too.Ubuntu might catch up, some day 🙂 thank you!(sorry for my poor english) It works fun in elementary os! I have been looking for directions for this for a while.
I use Ubuntu 14.04, so wasn’t sure that this would work.
But the directions you gave were simple to follow, and it works like a charm!
Thanks. hi 🙂worked great, i’ve been looking for a way to do this for a whilethanks a bunch ! This site uses Akismet to reduce spam. .Recent Posts
ContactAbout HecticGeekWelcome to HecticGeek, it is an independent blog founded back in 2010. We cover in-depth Linux OS, product review with other all technology-related software and tools. Our mission is to provide valuable and trustful technology-related content to our users.