Tell (most) Linux Web Browsers to open Gemini links with your favorite client
There’s Gemini space, and there’s the web. It’s easy enough to follow links from Gemini to a website because all modern devices know what http and https are, and how to launch a web browser, but what about the other way around?
Most web browsers on Linux will use xdg-open to open unfamiliar link types. Chromium, Epiphany, Ephemeral, Konqueror, Chrome, etc. If you’ve installed a Gemini client using a package or installer, it might already be able to send those clicks over. (Firefox works a bit differently)
But what if XDG doesn’t know which applications can open gemini links? Or if you have several Gemini clients, but it’s opening the wrong one?
Configure your default gemini: handler
- Check the settings by typing this:
xdg-settings get default-url-scheme-handler gemini
If there’s a handler configured, you’ll see a response like Kristall.desktop. If there isn’t one, it’ll exit without output.
- Find the name of the .desktop file for the Gemini client you want to use. It might be:
Depending on how you installed it, it might be in any of several places
- /usr/share/applications (systemwide)
- /var/lib/flatpak/exports/share/applications (Flatpak)
- ~/.local/share/applications (specific to your login)
If you didn’t install through a package or install script, you might need to [track down the .desktop file](How to set up the .desktop file for a Gemini client) and set it up properly.
- Set a new default by typing this (adjusted for the filename you found):
xdg-settings set default-url-scheme-handler gemini fi.skyjake.Lagrange.desktop
Allow specific websites to open gemini links
On some browsers, opening protocols in another application is a per-website permission (like allowing location access). The first time you click on a gemini link from a website, you’ll see a confirmation dialog asking if you want to allow that site to open gemini links in Lagrange (or whatever client you’ve chosen), with a checkbox to always allow that site.