Set default applications for certain filetypes
Having migrated recently from kde4 to openbox, I am still trying to make it as usable as possible. A couple of days ago I had to figure out a way to change the default application for some kind of filetypes such as pdf, mp3, mpeg etc. Back in kde4 times, this was possible through a specific menu on system-setting control panel. In openbox there is no such panel ( or I couldn’t find one, so if you know one plz tell me ) so I didn’t know where to look for. Fortunately after some digging on google pages, I found the place where the systems stores the default applications for all the mime types. This is:
/home/$user/.local/share/applicaions/defaults.list
So, below you many find my current defaults.list so you can understand how to setup your own list of your preferred applications
[Default Applications]
video/x-msvideo=smplayer.desktop
application/pdf=kde4-okularApplication_pdf.desktop
video/mp4=smplayer.desktop
image/jpeg=kde4-gwenview.desktop
You may find all the possible mime types by looking into /usr/share/mime/types file and all the possible .desktop files on /usr/share/applications/ :)
Comments
5 Responses to “Set default applications for certain filetypes”
Leave a Reply










Awesome. Thanks a bunch for this.
I recently shifted from XFCE to openbox and have been looking around for how to set this. Thanks again!
And thanks to that little message, I just realized I’ve been running a spoofed user-agent for a while, haha.
pretty sure there’s a typo in “applicaions”
You may also use the command line xdg-mime. This command will add to the .local/share/applications/defaults.list file automatically so for example to set the default application for blender scenes do the following
$ xdg-mime default blender.desktop application/x-blender
$ update-desktop-database ~/.local/share/applications
The usage is :
$ xdg-mime default $DESKTOPAPP $MIMETYPE
Was just chatting in #gentoo with hwoarang – my config wasn’t working, and xdg-open was opening firefox for some reason. xdg-mime was even reporting that okular was set as the pdf viewer!
The solution? Apparently, if you’re not in kde or gnome, xdg-open ignores its config file (??).
DE=kde xdg-open my.pdf works.
Time to edit your .bashrc (and/or .config/openbox/autostart) ;)