URL protocol handlers in basic Ubuntu Desktop

Open ~/.local/share/applications/mimeapps.list and add a line like:

x-scheme-handler/apt=apturl.desktop

xdg-mime

Maybe more elegant (in this example I use "apt", change it for any other scheme):

  1. Check registered MIME-types in /usr/share/applications/defaults.list.
  2. Add the apt.desktop file (here some examples) to ~/.local/share/applications/ (user-wide) or /usr/share/applications/ (system-wide).
  3. Build cache database of MIME types handled by desktop files (may need sudo):
    update-desktop-database
  4. Register a protocol with
    xdg-mime default apt.desktop x-scheme-handler/apt
    

This will append the new MIME Type for the scheme to either ~/.config/mimeapps.list or ~/.local/share/applications/mimeapps.list. You can register the new mime-type for all users on the system sudo xdg-mime install --mode system <xml file>.

Test with xdg-open "apt://foo.bar".

See also Adding a MIME Type.

Tags:

Url

Gnome

Dconf