0

This windows registry magic:

[HKEY_CLASSES_ROOT\shotgun]
@="URL:example Protocol"     # <---- URL for this example is example.com
"URL Protocol"=""
[HKEY_CLASSES_ROOT\example\shell]
[HKEY_CLASSES_ROOT\example\shell\open]
[HKEY_CLASSES_ROOT\example\shell\open\command]
@="\"python\" \"myContextMenuTriggerScript.py\" \"%1\""

Source for this above

So I can't say I understand it but apparently, via any protocol at all, and especially http or https I guess, when you visit a certain web page in your browser, in Windows with these keys and values stored in your registry, a python script will run on that webpage and do whatever you want in the context of that webpage. I use this functionality every day.

I am looking for this functionality, safely, in Linux and my only question is, does Linux have something LIKE the registry (as awful as that is to say) that will allow me to cause say Ubuntu to react to my visiting a webpage... and run a script... and what might that piece of the system be called?

Would you use gconftool to register a protocol this way?

Is this safe to do? <-------

Is it really the equivalent of doing it with Windows?

3
  • 2
    Read that website, it tells you how to do it on MacOS and "Linux" (probably works on BSD and others too). // It doesn't work on specific URLs. It allows you to assign a program to handle a certain protocol, eg. assume the OS doesn't know what mailto: is, you could set it up to open all such URLs in your mail program. Commented Oct 15, 2020 at 5:37
  • @OskarSkog Oh so if I collect mail from an SMTP server named example.com .... it would run the script run when it's made theSMTP connection as well? Commented Oct 17, 2020 at 19:49
  • No. First of all, mail is not collected from an SMTP server, it's collected from the IMAP or POP server. And the "URL protocol trigger" does not insert any hooks into the networking stack. My example would literally only tell Windows that a mailto: URL is to be opened by whatever program/script was specified, nothing special will happen when a program opens a connection to a specific port on a specific host. Commented Oct 17, 2020 at 20:21

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.