Setting up castor as handler for gemini URLs on a Gnome desktop
So, you’ve heard of that slick new gemini:// internet protocol and you managed to install or build (see below) the castor browser to use it. It works great, but now you would like to be able to click on a link in your http(s) browser to gemini and have it open castor for you. Here is how to do this on a Gnome desktop.
Step 1 – create a launcher for castor, by adding the following configuration into the file „~/.local/share/applications/castor.desktop“:
[Desktop Entry]
Version=1.0
Type=Application
Name=Castor
Comment=Gemini Browser
TryExec=castor
Exec=castor %u
Icon=/[path to castor repository]/data/org.typed-hole.castor.svg
MimeType=x-scheme-handler/gemini
Step 2 – register the gemini protocol to open with castor, by issuing this command:
xdg-mime default castor.desktop x-scheme-handler/gemini
Building castor
If at the time you read this, castor hasn’t been packaged for your OS yet, here is how you can build it locally.
Step 1 – clone the castor repository using git and change into it:
git clone https://git.sr.ht/~julienxx/castor
cd castor
Step 2 – On Ubuntu, you could install the build requirements locally with the apt-get install command mentioned below. If you are not using Ubuntu or you don’t want to add these packages to your environment, here is how to create a docker container that you can then subsequently use to run your castor builds in.
Start by creating the following „Dockerfile“ in the castor repository you just cloned (replace the 20.04 in the first line with a version matching your target Ubuntu release, change the time zone according to your locality):
FROM ubuntu:20.04 RUN apt-get update && \ DEBIAN_FRONTEND="noninteractive" TZ="Europe/Zurich" \ apt-get install -y build-essential rustc cargo libgtk-3-dev libgdk-pixbuf2.0-dev libssl-dev && \ rm -rf /var/lib/apt/lists/* ENV HOME /tmp
Step 3 – Create a build container image, then use it to build castor, installing it in your users bin folder:
docker build -t castor-build .
docker run -ti –rm -v $PWD:/tmp -w /tmp -u $UID castor-build make
mkdir -p ~/bin
ln -s $PWD/target/release/castor ~/bin/castor
You can find more and up-to-date information on how to customize castor over on the project page.
Discussion Area - Leave a Comment