I got a thing for MPlayer. There’s a good number of video players in Linux but the simplicity of MPlayer has always made it what I like to use. I like to use MPlayer without the GUI because once I learned the keybindings it makes for fast and bare-bones video player (to learn a little more about setting up MPlayer settings, look at this page). To be able have MPlayer as your default video player in KDE 4 you’ll have to do change mime associations and add MPlayer to the ‘Open with’ dialog.
Changing mime Associations
If you install MPlayer with a GUI, you can skip this step because it should install an icon and .desktop file (file for displaying in the Application menu and listing associated file types). If you install MPlayer without a GUI, likely it will not have one. Here’s a ‘mplayer.desktop’ file you can use:
Place this file in the application menu folder:
mv mplayer.desktop ~/.local/share/applications/
And the icon that goes with it:
mv mplayer.svg ~/.local/share/pixmaps
Open ‘System Settings’ (or whatever your distribution calls it), click on the Advanced tab and choose File Associations. Then select video in ‘Known types’. Go through videos you’d like MPlayer to open as default and place MPlayer at the top of the list then ‘Apply’. Note, you may have to wait a minute after doing the previous action before the mime types get registered. Now videos that you have saved on you hard drive can be clicked and loaded with MPlayer.
Mplayer in ‘Open with’ Dialog
Adding to Device Actions in System Settings
It may be faster and quicker to copy and paste the configuration file I post in the next step. I put this method up is case you want to learn how to add and configure special device actions.
Open ‘System Settings’ and go to the Advanced tab and click on Device Actions. ‘Add’ a new action named ‘MPlayer’. Add a new action like: ‘mplayer dvdnav://’. Most distributions compile MPlayer with DVD navigation now so this should work. Remove ‘The device must be of the type Storage Volume’ and ‘The devices property Storage.Volume.ignored must equal false’ properties. Select ‘All of the contained conditions must match’ then click ‘Add’.
Requirement type: Contains Other Requirements Requirement type: Is A Requirement
Select ‘All of the contained conditions must match’ then ‘Add’:
Requirement type: Is A Requirement Restriction type: Compare Value To Device type: Storage Volume Value name: Ignored Equals: false
Add another to ‘All of the contained conditions must match’ and add this to recognize you DVD disk:
Requirement type: Is A Requirement Restriction type: Compare Value To Device type: Optical Disk Value name: Avaliable Content Equals: 'Data|VideoDvd'
Save the configuration and you should see the ‘Open with’ dialog display MPlayer. For me this didn’t though and I ended up creating the configuration manually and only then did it show up after I rebooted. Rebooting should be necessary though and likely this step would have worked if I had just logged out and back in again. I had been playing with the configuration a bit before I learned how to do this and likely this is a bug in system settings. If this doesn’t work for you look at the alternative below.
Using a Pre-made Configuration
Use this pre-built configuration if you don’t want to do the above and put it in the right directory to have MPlayer appear in the ‘Open with’ dialog:
[Desktop Entry] X-KDE-Solid-Predicate=[[ StorageVolume.ignored == false AND OpticalDisc.availableContent == 'Data|VideoDvd' ] OR [ StorageVolume.ignored == false AND OpticalDisc.availableContent == 'Data|VideoDvd' ]] Type=Service Actions=open; [Desktop Action open] Name=Open with Video Player (Mplayer) Exec=mplayer dvdnav:// Icon=/home/todd/.local/share/pixmaps/mplayer.svg
Now move it to the right directory:
cp Mplayer.desktop ~/.kde4/share/apps/solid/actions/Mplayer.desktop
Again, you may have to login/logout before it becomes available (reboot worked for me but shouldn’t be necessary).
And you should be good. Enjoy MPlayer!