When installing calibre the .desktop files calibre-ebook-viewer.desktop and calibre-gui.desktop in /usr/share/applications contain many MIME type associations which calibre shouldn't be responsible for. An example line looks like this: MimeType=text/plain;application/vnd.ctc-posml;text/html;application/oebps-package+xml;text/rtf;application/pdf;application/vnd.amazon.ebook;application/x-cbz;application/x-cbr;application/octet-stream;text/fb2+xml;application/vnd.oasis.opendocument.text;application/epub+zip;application/x-mobipocket-ebook;application/xhtml+xml; The result is that nearly all file types will now open in calibre, also file types calibre is no able to handle (e.g. application/octet-stream which applies to libraries or archive files in general. Also text/plain or text/html should not be calibre's desktop files. A simple line such as the following would suffice: MimeType=application/vnd.ctc-posml;text/html;application/oebps-package+xml;application/vnd.amazon.ebook;application/x-cbz;application/x-cbr;text/fb2+xml;application/epub+zip;application/x-mobipocket-ebook; You may edit out a few more; I just removed those I know they should not be in that file. In posted a temporary workaround for this issue in the Gentoo forums (linked above) but this should be fixed soon. Reproducible: Always Steps to Reproduce: 1. Install calibre 2. See how messed up your file associations are.
Thanks, I've updated the calibre-0.7.48 ebuild to remove those mime types: --- calibre-0.7.48.ebuild +++ calibre-0.7.48.ebuild @@ -159,6 +159,14 @@ dodir /usr/share/icons mv "$HOME"/.local/share/icons/* "$D"usr/share/icons/ || die "failed to install icon files" + + # Bug #358065 - Remove inappropriate mime types from *.desktop. + sed -e "s:application/octet-stream;::g" \ + -e "s:text/html;::g" \ + -e "s:text/plain;::g" \ + -i "$HOME"/.local/share/applications/*.desktop \ + || die "sed failed" + domenu "$HOME"/.local/share/applications/*.desktop || die "failed to install .desktop menu files"
(In reply to comment #1) > Thanks, I've updated the calibre-0.7.48 ebuild to remove those mime types: > > --- calibre-0.7.48.ebuild > +++ calibre-0.7.48.ebuild > @@ -159,6 +159,14 @@ > dodir /usr/share/icons > mv "$HOME"/.local/share/icons/* "$D"usr/share/icons/ || > die "failed to install icon files" > + > + # Bug #358065 - Remove inappropriate mime types from *.desktop. > + sed -e "s:application/octet-stream;::g" \ > + -e "s:text/html;::g" \ > + -e "s:text/plain;::g" \ > + -i "$HOME"/.local/share/applications/*.desktop \ > + || die "sed failed" > + > domenu "$HOME"/.local/share/applications/*.desktop || > die "failed to install .desktop menu files" You ought to add text/rtf, application/pdf and application/xhtml+xml to that list as well then it should be fine.
And application/vnd.oasis.opendocument.text which is the open document format (used by OpenOffice/LibreOffice, file extension: .odt).
Thanks, those are added now too.
This is the wrong fix for this issue. Since calibre handles PDF, RTF, TXT, ODT filetypes removing them from the .desktop files is broken. A desktop file is supposed to list all mimetypes that the application can handle. See http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s07.html You need to patch xdg-utils on Gentoo to not adjust the default mimetype handlers when installing .desktop files instead.
(In reply to comment #5) > This is the wrong fix for this issue. Since calibre handles PDF, RTF, TXT, ODT > filetypes removing them from the .desktop files is broken. A desktop file is > supposed to list all mimetypes that the application can handle. See > http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s07.html > > You need to patch xdg-utils on Gentoo to not adjust the default mimetype > handlers when installing .desktop files instead. @freedesktop-bugs: If you guys are thinking about patching xdg-utils as suggested here, then please leave us a comment. Thanks!
we don't need to do that, DEs should provide a defaults.list (see gnome-session ebuild for example) if they have a preferred list of applications. xdg-utils just generates a cache and I'm pretty sure it doesn't have a default mechanism itself, it just takes the first entry corresponding the to mime in the cache.
Thanks for the explanation. I'll go ahead and remove you from CC now. I plan to fix the ebuild so that it doesn't filter so many mime types from the desktop files. We shouldn't need to filter anything that is likely to have a sane default defined by the DE, or anything for which it would not be insane to have calibre listed as the sole provider in /usr/share/applications/mimeinfo.cache. I suspect that the main reason for this bug report is that one or more of calibre's desktop files used to list application/octet-stream in the MimeType field, which was somewhat insane to have listed as the sole provider in mimeinfo.cache, given that many DEs may not have a default handler for such a generic mimetype. Looking at the latest calibre desktop files, application/octet-stream is no longer listed in any of the MimeType fields. So, perhaps there's no longer any need to filter anything.
*** Bug 384289 has been marked as a duplicate of this bug. ***
Just my two cents, I absolutely hate something taking over my personal document and piping it to something else without first asking me. (See duplicate closed bug #384289) And, even if it did ask, I'd still say no. ;-) (Thanks Zac for notifying me of this!)