💾 Archived View for tobykurien.com › articles › gemini-epaper.gmi captured on 2023-04-26 at 13:01:13. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-04-19)
-=-=-=-=-=-=-
Browsing gemini content on a Kindle is a pleasant, distraction-free experience
Three months after discovering the Gemini protocol[1], I'm still super excited about the possibilities it offers, especially the ability to escape the user-hostile web. For many years I've been thinking about how I can scrape data off the web (things like traffic alerts, weather report, news, etc.) and make it accessible in a simple way on an LCD display or e-paper display, perhaps even on a smart watch. Gemtext offers a great format in which to scrape the data (it's simple enough to parse with a micro-controller), with the bonus that the content can also be published to other devices and users via the Gemini protocol. I've already setup bridges/scrapers to Gemini for my daily feeds, and have been reading them on my smartphone.
1: https://en.wikipedia.org/wiki/Gemini_(protocol)
As part of my war on doomscrolling[2] I recently removed all social media and news content from my smartphone, and instead read books on my Kindle. This got me thinking about building a simple device to read Gemini content on e-paper, since Gemini is mostly just text and very simple to parse. I'm pretty sure this could be done with a 4.2" e-paper display[3] paired with an ESP32 micro-controller. It turns out, such a device already exists in a great form factor: the m5paper[4]. Wouldn't this make a great pocket Gemini-reader?
2: gemini://tobykurien.com/articles/war-on-doomscrolling.gmi
3: https://www.waveshare.com/wiki/4.2inch_e-Paper_Module
Before going down this path however, I thought about the e-paper device I already have: an old Kindle 3. It has an experimental web browser, but I'd never really used it because it's SSL stack is outdated and so doesn't work with most modern websites, and even when it does, the experience is frustrating. I thought of two options to read content on this Kindle: scrape the content into text files and copy it over USB for reading; or use a proxy server for the experimental web browser. I manually tried the first option by copy-and-pasting a few articles from web sites onto the Kindle, and this does indeed work very well. However, since there isn't a Gemtext reader for Kindle, I looked into the second option.
The easiest thing to try was to use the Mozz.us Gemini-to-HTML proxy server over at portal.mozz.us[5]. It seems this site still allows old SSL versions, so it actually works on the Kindle:
Mozz.us proxy on Kindle 3 [IMG]
If you have a Kindle, give this a try! It brings Gemini content to the Kindle in a way that still feels like reading a book. You can't open multiple tabs, navigating around takes some time (you can't just fling content around), there is no JavaScript to popup or distract you, all of which leads to a very pleasant distraction-free reading experience.
There are some issues, however. You can't adjust the font size, font type, line spacing, or contrast. You can zoom, but it resets when you navigate to another page. There is extra cruft at the top of all pages. You're reliant on a server which may go down or tighten up it's SSL support. To solve these issues, I looked into running a local Gemini-to-HTML proxy on a Raspberry Pi. I found two candidates: Gneto[6] and Kineto[7]. After trying both, I settled on Kineto, because Gneto doesn't work on URLs that have query parameters. Both allow you to specify a CSS stylesheet, which gives you almost total control over the rendering of the pages.
6: https://github.com/pgorman/gneto
7: https://sr.ht/~sircmpwn/kineto/
To compile Kineto on the Raspberry Pi, I had to first download and install the latest version of Go lang[8] from the website, since the version of Go in the OS repository is too old. I then spend a lot of time tweaking the stylesheet to work on the Kindle according to my preferences. The Kineto template makes use of modern HTML tags such as **article**, **details**, **summary**, etc. The Kindle browser does not understand these, and so just dumps out their content without applying any styles to them. This created problems with the display, and so I had to modify the Kineto source to comment them out. Finally, with all the changes in place, I can run Kineto as:
nohup ./kineto -b 0.0.0.0:9065 -s kindle.css gemini://tobykurien.com &
The end result is a clean, book-like display of the content:
Kindle 3 viewing my Gemini capsule [IMG]
Kindle 3 viewing Gemini content via Kineto proxy [IMG]
If you'd like to run this verion of Kineto yourself, the code and even the compiled binary are available in this repo[9].
9: https://cloud.tobykurien.com/cgi-bin/repo/kineto/dir?ci=tip
I think the most satisfying type of programming is when you create something simple that makes your life a little easier or more pleasant, like home automation. It's even better when one little side project leverages another little side project. Reading web content scraped into Gemini on my Kindle ranks right up there with satisfying side projects!
__