When you open a link on the internet such as ftp://myserver.com, it prompts you to open the link with your FTP client of choice. Same thing with irc://freenode.net. It prompts you to open the link with your IRC client of choice.
How can I declare a new url protocol to associate link with my binary/script ?
Or how can I add my application to the list available to handle ftp url ?

  • I don't understand what you want. You can easily make a bash script that takes web addresses as an argument but they wont be a working web application. Do you want to make a web application?
    – jesse_b
    Feb 26 '18 at 16:38
  • 1
    Please see man xdg-open Feb 26 '18 at 16:43
  • I'd like to run my program when I click a link in my webbrowser. Similar to magnet links. If you open a magnet link (magnet://<SHA256-HASH>) it opens a torrent program. If you open a FTP link (ftp://myserver.com) it opens an FTP client. Now my question is how can I create my own program that runs when I open a abc://myserver.com link?
    – Maplicant
    Feb 26 '18 at 16:55
  • 1
    You take it as a normal argument and configure your DE to invoke it when it opens a URI with the appropriate scheme. Feb 26 '18 at 17:57
  • What is your OS ? there's the answer for ubuntu here askubuntu.com/questions/514125/…
    – Kiwy
    Mar 1 '18 at 15:49

Simple as :


for f; do
    xdg-open "$f" &

Check man xdg-open

  • 1
    This isn't exactly what I'm looking for. I'd like my program to be called (not open a link itself) when I click on a link as if it were a callback.
    – Maplicant
    Feb 26 '18 at 17:00
  • 2
    All click stuff are part of WM (window manager) configuration Feb 26 '18 at 17:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.