5

xdg-open can open urls, but only ones starting with ftp, http or https. But my browser will happily open other urls in programs that have a handler for it registered, e.g. f5-vpn:// urls (for a vpn, this launches the vpn client after authenticating in a web app).

How can I open other urls like f5-vpn:// with their registered handler from the command line, just like the browser does?

1 Answer 1

9

xdg-open can handle any URI scheme, as long as it’s registered with a handler for the corresponding x-scheme-handler MIME type. To do this, add an entry to ~/.config/mimeapps.list ($XDG_CONFIG_HOME/mimeapps.list), in the “Default Applications” section, pointing to the appropriate .desktop file. For example:

[Default Applications]
x-scheme-handler/f5-vpn=firefox-esr.desktop
3
  • This works (with x-scheme-handler/f5-vpn). xdg-open now starts the vpn client. But the vpn client is registered to receive urls to open through dbus, so it just closes again after a timeout. Can xdg-open do opening through dbus? (When opening the url from the browser, that works.)
    – JanKanis
    Commented Aug 14 at 7:03
  • Have you configured the scheme to open the VPN client, or the browser? Commented Aug 14 at 7:08
  • 1
    More explicitly, the idea behind using firefox.desktop (or equivalent for your browser of choice) to handle f5-vpn: is that, since the browser already does the right thing, asking it to handle such URIs from xdg-open (and others) should produce the desired behaviour. Asking the VPN client to handle f5-vpn: is unlikely to be as effective. Commented Aug 14 at 14:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .