💾 Archived View for freeshell.de › windowsprotocolhandler.gmi captured on 2022-03-01 at 15:00:47. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-11-30)
-=-=-=-=-=-=-
I thought that I'd have to configure my web browser to do this. Wrong. I had to tell Windows that the Gemini protocol exists and how to launch a client. I followed these instructions:
Registering an Application to a URI Scheme
[Obligatory disclaimer about dangers of registry editing goes here]
OK, that page might disappear, so lets put the relevant bits in here.
You have to add the scheme as a key under HKEY_CLASSES_ROOT, and add the following keys and values
HKEY_CLASSES_ROOT gemini (Default) = "URL:Gemini Protocol" URL Protocol = "" DefaultIcon (Default) = "C:\path\to\some\icon,1" shell open command (Default) = cmd /c C:\somepath\myGeminiClient.bat "%1"
Yes, there's an empty string in there:
...the URL Protocol string value indicates that this key declares a custom pluggable protocol handler. Without this key, the handler application will not launch. The value should be an empty string.
I don't know what the icon is used for, or whether it even has to exist. The number after the comma is the offset into the set of icons in the file, because a Windows executable can contain several icons. I used a .ico file, and I think that the number after the comma in that case is 0.
The cmd /c part is a hack to make a batch file (or another kind of script) work. If it's a native executable instead, you don't need cmd /c.
[Another disclaimer about dangers of registry editing]
It's also possible to create a file with this stuff in it. Give if any name, but make the extension .reg and when you open it, it should get magically applied to the registry.
The file should contain something like this, but obviously fix the paths for your situation.
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\gemini] "URL Protocol"="" @="URL:Gemini Protocol" [HKEY_CLASSES_ROOT\gemini\DefaultIcon] @="C:\\path\\to\\some\\icon.ico,0" [HKEY_CLASSES_ROOT\gemini\shell] [HKEY_CLASSES_ROOT\gemini\shell\open] [HKEY_CLASSES_ROOT\gemini\shell\open\command] @="cmd /c C:\\somepath\\myGeminiClient.bat \"%1\""
So, now when I see a Gemini link on a web page, I can click it. My browser gives me a warning - am I sure that the web site should open the other app? Yes, but thanks for caring enough to ask.
Bonus: I did Gopher too, because my home-brew client supports it. I haven't found a web page with a gopher:// link yet, but it should work.
Edit: now I have, and it does.
Double bonus: I did it for IRC too.