Lagrange v1.4: Split View and Gempub

Version 1.4 adds a split view mode and basic support for reading Gempub books. As usual there's a few tweaks to page appearance, and improvements done for the iOS TestFlight pay off on the desktop as well.

v1.4 is smaller in scope than the previous two releases. This is mostly because more time was spent on bug hunting, and implementing the split view mode required deep changes in the UI framework. These changes are anyway necessary for future improvements so I consider this a down payment.

I feel that split view mode in particular is a fundamental improvement in the browsing experience. The limitations of Gemtext naturally lead to menu/list based navigation structures, so keeping such menus visible on the side is a great way to keep track of your reading progress.

Split view

Since the beginning, Lagrange has been limited to displaying a single page (tab) at a time. Initially, one could run multiple instances of the app at the same time, but that has now been prevented to avoid data loss because the instances would overwrite each other's files. The most flexible solution to displaying multiple pages would be to have many independent windows, each saving their state persistently. Then you could have a longer document, like a Gemzine, open in one window while using another for casual browsing.

Managing the UI across multiple windows still requires more work, but now in v1.4 it is possible to have two tabs open in split view mode. This is not limited to page content: most UI elements, including sidebars, URL input field, and the search bar are all duplicated.

If you prefer single-view browsing, don't worry: that remains the default behavior. Apart from Gempub reading (discussed below), split view mode has to be intentionally activated via some method, for example holding down Shift while clicking on a link.

Pinning and link highlighting

Instead of settling for simply having two independent browsers, I tried to come up with advantages unique to having two connected views. After using split view for a while, I came to the conclusion that it can help with the common use case of visiting a set of links.

The default split view behavior is designed to assist in navigating index pages and menus. The feature is called "split view pinning". The idea is that whenever split view mode is active, one side of the split is considered "pinned", so when you click on links, they will always open to the other side of the split. If you prefer to have two independent browsers this feature can be disabled in Preferences > General.

Another way to take advantage of split views and pinning is the new "linksplit" bookmark tag. This causes all links on the tagged page to open on the side, automatically activating split view mode if it isn't already in use. This way you can easily switch to split view mode when visiting chosen capsules, effectively pinning the "linksplit" page.

To further assist in reading a sequence of linked pages, now if you have a page open in one tab, links pointing to that page on other tabs will have a special highlighted background. You can see examples of this in the screenshots on this page.

Local directory/ZIP viewing

v1.4 enhances the capabilities of "file://" URLs so you are now able to view the contents of local directories. Also, ZIP archives are basically just directory trees, so those can be viewed as well. However, this only works with locally saved ZIP archives, because (presumably) the server has no visibility to directories inside a ZIP archive.

"Show Downloads" was added in the macOS File menu and on other platforms in the navbar (hamburger) menu. This shows you the contents of the configured downloads directory. Pro tip: Bookmark this directory for convenient access via the URL bar.

Gempub

Does it make sense to extend Lagrange to effectively be an e-book reader as well? Generally speaking, probably not, but Gempub is so closely tied to the format of a typical static Gemini capsule that adding this capability doesn't actually require much new functionality. From the client's point of view, you're browsing Gemtext pages as usual, they're just coming from inside a local ZIP archive instead of being transferred over the network.

Gempub is a very recent idea, so things may still change here in the future. The initial implementation has been built with actual books in mind. When opening the book contents, split view mode is enabled according to the "split view pinning" setting and the first chapter is shown on the side. (This may or may not be appropriate behavior when viewing an archived Gemini capsule.)

Thanks to app state saving, your reading position in the book should be retained even if you quit the app. However, you'll still need to keep the tab(s) open, because scroll position is saved per open tab.

Possible future improvements could entail:

Demo

Changes to styling

I've continued tweaking the appearance of links. The main concern has been to make it clearer which links have already been visited. To that end, bold link styling is now applied to unvisited links only. The visited state of a link has previous been communicated via link icon color, but that can be hard to discern in some color themes.

As before, bold links can also be completely disabled via Preferences.

All the sans-serif fonts now come in three weights: regular, semibold, and bold. The semibold weight is used for links, while the bold weight is used for headings. This was already the case with Nunito, but now also Fira Sans and Source Sans have these additional weights available, hopefully improving readability of link lists so you are not faced with a wall of heavy bold text.

Sidebar action buttons

A small but useful change in the sidebar: I've added buttons for creating and importing identities (previously available via menus/shortcuts), and a mode switch for seeing only unread feed entries. The Unread mode in particular could still use some improvement, with entries disappearing instantly after being read, but it gets the job done.

Smooth scrolling and multitouch

Work on the mobile port pays off on the desktop as well: all lists now support smooth scrolling. This was part of a mouse wheel/finger event refactoring effort that aimed to unify scroll behavior across the UI.

Touch screen support in general was enhanced with multitouch capabilities, so you can use a pinch gesture to zoom, and scroll more than one widget at the same time. When scrolling via touch there is also a bounce at the ends of scrollable areas, emulating iOS behavior (to a degree).

Next up

Multiple parts of the UI could use further work:

I'll probably try to find a better solution than downloadable resources for the font library. One possibility is to simply make resources more modular, so one can manually update them, and/or leave it up to the OS package manager.

I also want to try tackling bidirectional text rendering sooner or later.

Work on the iOS beta continues, too, although updates have been / will be a little sporadic for the time being. I'm a bit concerned about high CPU usage during UI rendering. I'll need to profile things a bit and understand what exactly is going on. Drawing the UI should not tax modern iPhones really at all, so it's possible that tweaks can be applied to allow the CPU to take a rest without slowing things down too much. The phone UI also still needs a bit of rethinking.

So, lots of cool stuff to work on!

πŸ“… 2021-05-07

🏷 Lagrange

CC-BY-SA 4.0

The original Gemtext version of this page can be accessed with a Gemini client: gemini://skyjake.fi/gemlog/2021-05_lagrange-1.4.gmi