Getting Firefox to use KDE's file associations
One of the biggest things that annoys me about running Firefox in KDE is it's lack of integration with KDE. It uses GTK instead of QT, but using the GTK-QT engine kind of solves that. However, Firefox won't use KDE's file associations. Well, it's possible to modify Firefox's file associations manually. Unfortunately, I don't know where KDE saves its file associations, but this fix works fine. Apparently, Firefox reads some of its associations from the /etc/mailcap file. So simply add lines to that file and Firefox will obey them.
For example, to open PDF files in KPDF, use the following line:
application/pdf; kpdf '%s'; test=test "$DISPLAY" != "" ; description="PDF Document" ; nametemplate=%s.pdfYou must make sure to use the correct MIME type, though, or it won't work. So while application/vnc.ms-excel (for Excel files) will work, application/x-msexcel won't, even though it's listed as an alias. Here's some more: Open documents in OpenOffice:
application/msword; openoffice.org2.3 -writer '%s'; test=test "$DISPLAY" != "" ; description="Microsoft Word Document" ; nametemplate=%s.doc application/vnd.ms-powerpoint; openoffice.org2.3 -impress '%s'; test=test "$DISPLAY" != "" ; description="Microsoft PowerPoint Document" nametemplate=%s.pps application/vnd.ms-excel; openoffice.org2.3 -calc '%s'; test=test "$DISPLAY" != "" ; description="Microsoft Excel Document" ; nametemplate=%s.xlsOpen archives in ark:
application/x-tar; ark '%s'; test=test "$DISPLAY" != "" ; description="Tar Archive" ; nametemplate=%s.tar application/x-bzip-compressed-tar; ark '%s'; test=test "$DISPLAY" != "" ; description="BZ2 Compressed Tar Archive" ; nametemplate=%s.tbz application/x-bzip-compressed-tar; ark '%s'; test=test "$DISPLAY" != "" ; description="BZ2 Compressed Tar Archive" ; nametemplate=%s.tar.bz2 application/x-bzip; ark '%s'; test=test "$DISPLAY" != "" ; description="BZ2 Compressed Archive" ; nametemplate=%s.bz2 application/x-gtar; ark '%s'; test=test "$DISPLAY" != "" ; description="GZipped Tar Archive" ; nametemplate=%s.tgz application/x-gtar; ark '%s'; test=test "$DISPLAY" != "" ; description="GZipped Tar Archive" ; nametemplate=%s.tar.gz application/x-gzip; ark '%s'; test=test "$DISPLAY" != "" ; description="GZipped Archive" ; nametemplate=%s.gz application/x-rar; ark '%s'; test=test "$DISPLAY" != "" ; description="Rar Archive" ; nametemplate=%s.rar application/x-7z-compressed; ark '%s'; test=test "$DISPLAY" != "" ; description="7zip Archive" ; nametemplate=%s.7z application/zip; ark '%s'; test=test "$DISPLAY" != "" ; description="Zip Archive" ; nametemplate=%s.zip
