A More Modern Gtk3 Jalv Frontend

Posted on in , ,

My simple single-plugin LV2 host, Jalv, isn't quite sure whether it's a developer utility or polished user program, but in any case, it had become stale in the past few years and needed an update.

Most of those changes are internal and only interesting for those who use it as a basis for larger systems. The internals have been largely rewritten to support various things, but this post isn't about that. This post is about a more obviously stale thing: the Gtk2 interface.

In keeping with the free desktop tradition of constant breakage with reduced functionality, that toolkit is now EOLed, and soon the ability to embed GUIs whatsoever will probably go away. Luckily though, we're not quite there yet, and it's still possible/feasible to embed GUIs in Gtk3 (at least on X11), so things can continue roughly as they were for a while. Gtk2 is EOLed though, which is a problem for distributions, and I have no interest in maintaining code for a dead toolkit, so that frontend is gone entirely in the latest release. This does mean that some plugin GUIs written in Gtk2 will no longer work, but that's inherent to the situation (and why general plugin GUIs shouldn't use Gtk).

This seemed like a good time to update the UI to be a bit more “modern”, particularly since a menu bar has never really made much sense here anyway. I replaced this with a header bar, which I think does suit plugins better. For example, here's the custom GUI for the LSP Compressor:

Custom UI for LSP Compressor

As always, there's also generic controls, with a few refinements but still using the same boring stock widgets:

Generic UI for amsynth

All of the menu items have been moved into a single menu button, which is a pattern I'm sceptical of in general, but it works fine for a very simple applications like this. The preset menu can be unwieldy, but that's a whole topic unto itself that I hope to tackle more comprehensively later.

Code-wise, it's long been a problem that the rudimentary (lack of) architecture couldn't easily support the more advanced features people wanted from it. So, I've reworked everything into a more serious application, with a more explicit architecture and communication patterns that make adding new features much easier. As far as the Gtk frontend goes, I've also switched to using more modern APIs like GtkApplication, GAction, and so on. To be fair, these parts are quite nice. Actions are a pretty good model for building accessible GUI applications, and these new APIs encourage doing the right thing. There's still some areas that need work, but jalv.gtk3 (the version which has a .desktop file and all that) is much closer to being a proper application that integrates with the desktop environment now, and smells less like a hackey program that developers just use to check if their plugin works.

That aside, Jalv is still frequently used from the command-line, and there's a major QoL improvement there as well: the positional argument now accepts files and directories, not just plugin URIs. The code will try to figure out what to do automatically, for example, if a bundle or data file only describes a single plugin, then that plugin is loaded. Presets can also be passed (by path or by URI), which will load the appropriate plugin with that preset initially applied. In short, it's more like the “do what I mean” interface many people expect.

It's been entirely too long since the last release, but now that the host libraries and Jalv are up to date with most issues resolved, I'm going to try to do some broader cross-project efforts to address a few things that are a mess across the LV2 ecosystem as a whole, with Jalv serving as a sort of reference implementation. For now, though, it's just a much better implementation of the same old features.