I just encountered the same issue, but then for opening a mailto:
link. The approach to debug the problem is probably similar to yours, however.
First, find what handles the mailto (or in your case, http) scheme:
$ xdg-mime query default x-scheme-handler/mailto
kmailservice5.desktop
Now, what is kmailservice5.desktop
?
$ locate kmailservice5.desktop
/usr/share/applications/kmailservice5.desktop
Opening the above file shows:
[Desktop Entry]
Type=Application
Exec=kmailservice5 %u
Icon=mail-message-new
MimeType=x-scheme-handler/mailto;
X-DocPath=kioslave5/mailto/index.html
NoDisplay=true
# KMailService is the handler for mailto URLs
Name=KMailService
...
I wonder what kmailservice5
does?
$ kmailservice5 --help
xdg-open -- opens a file or URL in the user's preferred
application
Synopsis
xdg-open { file | URL }
xdg-open { --help | --manual | --version }
Use 'man xdg-open' or 'xdg-open --manual' for additional info.
This is exactly the same output as xdg-open --help
! That's weird... I looked up the source of kmailservice5
and found http://api.kde.org/frameworks-api/frameworks5-apidocs/kio/html/kmailservice_8cpp_source.html. It is a simple application that calls QDesktopServices::openUrl
https://doc.qt.io/qt-5/qdesktopservices.html#openUrl (In KDE4, the mail application was explicitly invoked via KToolInvocation::invokeMailer
; My partial upgrade to KDE5 is probably the reason for this breakage).
In other words, mailto:... opens the handler of mailto:, which opens the handler of mailto:, etc. This never ends and the only way to end this loop was to issue killall kde-open plasma-desktop
.
To solve the issue I created a robs-mailto.desktop
with the following content:
[Desktop Entry]
Type=Application
Exec=kdialog --msgbox "Rob's mailto handler: %u"
Icon=mail-message-new
MimeType=x-scheme-handler/mailto;
Name=RobsMailtoHandler
and registered it as follows:
$ xdg-mime default robs-mailto.desktop x-scheme-handler/mailto
and verified that it was correctly registered:
$ xdg-mime query default x-scheme-handler/mailto
robs-mailto.desktop
$ xdg-open mailto:test@example.com
# (opened a KDialog window that printed the email address, as I specified)