When I click on PDF from Calibre’s main window or click on View it opens up my Dolphin file-manager and shows the following dialog on top of the folder:
Trying to open a file as a folder:'file:///home/shuvashish76/Calibre/Main/Author_name/Book_title.pdf'
from there (file-manager) if I click on the PDF it opens up my default Okular application.
I’ve already set “File Association” for PDF to open in Okular + Okular as default “PDF viewer” application from system settings.
[If I use Calibre’s “Open with” external-plugin then it does work, so I guess something is misconfiguration on my side. Is it somewhat related file:// URI here?]
How to fix it so that it’ll always open in my default application with Calibre’s View option?
Calibre: v9.14 (isolated installation as instructed at official documentation)
OS: EndeavourOS x86_64
Kernel: Linux 6.18.48-1-lts
DE: KDE Plasma 6.7.4
WM: KWin (Wayland)
Dolphin: v26.08.0
KDE Frameworks: 6.29.0 | Qt: Using 6.11.2 and built against 6.11.1
I asked about this at Calibre’s forum and according to the developer it’s something related to xdg-open.
like xdg-open 'filepath.pdf' ? It just opens up the Dolphin with the same message as shown in my OP screenshot, from there clicking “Open as file” works as expected in Okular.
I’ve already set “File Association” for PDF to open in Okular + Okular as default “PDF viewer” application from system settings. It does open in default app Okular when I click on PDF from Dolphin but not from Calibre. Doesn’t help
If you Calibre’s “Preference > Use internal viewer for > PDF” then it’ll open directly in Calibre Viewer when you simply click on Calibre’s “Cover Browser”.
But I’ve disabled that as I don’t want to use Calibre’s Viewer.
When disabled it used to open in whatever app set for default “File Association”, but not anymore so I guess it’s something related to recent QT or xdg-open changes.
Also as I mentioned in Calibre’s forum, it works as expected if I switch to Niri WM that confirms it’s related to QT/xdg-open.
In this case xdg-open select kde-open to handle the opening. You can also try to call kde-open file.pdf.
Does it make a difference if you call xdg-open with file as parameter or url:
xdg-open ~/Documents/file.pdf
xdg-open file:///home/user/Documents/file.pdf
(you can try it with kde-open as well)
No. It is the tool xdg-open falls back, when the env variables (see above) are not set. It’s a old tool from the time Konqueror was the default file manager in KDE.
Please try also xdg-mime query default x-scheme-handler/file
When I set this mime-type to org.kde.dolphin.desktop, xdg-open opens both - Dolphin and Okular