You may have a need to have custom URLs such as ssh://yoursite.com processed with your own script. This is pretty easy to do with just a couple commands.
Lets start by creating the script to actually do the work. For this example we are going to launch a ssh so the script is very simple. In fact, we could actually skip making a script for ssh but it there may be more logic you want to add beyond simply launching a single command so a script file is needed.
Edit the file /home/yourname/bin/ssh-handler with your favorite editor.#!/bin/bash
Make this file exicutable using chmod. Next we need to create the desktop file that tells the system how to get to the script file we just created.
Edit the file /home/yourname/.local/share/applications/ssh.desktop.[Desktop Entry]
The %U on the last line is very important. That is the URL that is to be passed along to the script. You will need the full path to the script. You can't short cut using ~/ if you expect your script to run.
Finally we need to tell xdg to use the desktop file we just created when the ssh protocol is used in a link. The command looks like this...xdg-mime default ssh.desktop x-scheme-handler/ssh
Next time you create a link to any ssh site using the format ssh://somesite.com, your script will fire off and perform the needed steps.