Redecorating Setzer
image

The Linux Experience, tập 2. This time we delve into the development of a fork of a GTK app.

Setzer is a LaTeX editor written in GTK. My only gripe with it is that its UI is somewhat outdated. To elaborate on this, I’ll have to explain (rather haphazardly) how things should be, how the modern GTK experience should be.

Nowaways, a lot of GTK apps are transitioning to “libadwaita apps”, short for modern GTK apps that use GTK4 and libadwaita. You could argue that there’s a difference between a GTK app and a GNOME app, that a GNOME app uses libadwaita and a GTK app doesn’t have to. And it’s true that ElementaryOS also uses GTK, and so is PopOS. But these days the default GTK look is synonymous with the libadwaita look (the default GTK theme is called Adwaita, duh). ElementaryOS and PopOS are outliers. So far as I can tell, Setzer goes for the default GTK look.

The Situation

Setzer has been stuck in GTK3. Only two months ago has the creator updated it to GTK4. But it still hasn’t adapted the new UI elements.

Most importantly, Setzer is not a libadwaita app. It seems that the creator uses Debian, though I don’t know what desktop environment they use exactly. I’m using Arch Linux with the desktop environment GNOME 44. Almost all apps here use libadwaita, Setzer is the only standout. From the get-go there are a lot of inconsistencies in UI. I filed an issue and it doesn’t seem like they’re interested in making UI changes. I don’t even know if they are aware of the problems here. No more talk, I’m making my own fork, slowly adapting libadwaita widgets and just generally best-practice APIs, while inventing some new stuff too (hopefully should fit well with libadwaita). You can check it here. I’ve split new features into their own branches, but a preview branch dev is available. See for yourself, all feedbacks are welcomed!

The Changes

A lot, but most are currently not worthy of preview.

Some changes, though, are drastic. Let’s make some comparisons, I’ll give you an example of how a normal implementation should be, then how Setzer did it, and how I tried to make a compromise between two versions.

Here’s a page in the Preferences window of the GTK app Black Box (also the terminal app I used for dev!)

Preferences Window in Black Box.

Preferences Window in Black Box.

And other GTK apps have this kind of Preferences window, too.

Below is the current Preferences window in Setzer:

Current Preferences window in Setzer.

Current Preferences window in Setzer.

Here’s my new version. It’s all functional but here’s one page of the window for previewing’s sake. This version uses Adw.PreferencesWindow thus fixes a lot of layout issues:

A page in the new preferences window.

New version of the preferences window.

How about another comparison?. Here’s the About window in the GTK app GNOME Builder:

About window in Builder.

Again, cannot emphasize enough how most GTK apps today have this kind of window. There can be some variations, creative touches, but they mostly bear the same layout. There’s a sense of cohesion, because indeed you’re in one desktop environment.

Here’s the current About window in Setzer.

Current About window in Setzer.

Current About window in Setzer.

Here’s my version. Perhaps more info should be filled in as it looks quite empty:

New About window.

New About window.

Also, somewhat related to my effort. I’ve recently requested the Setzer app icon to be Adwaita-ized in the MoreWaita project. As of the writing of this blog, a new Setzer icon has been added as an app icon theme, so try it out! Below are the old and new icons respective. Subtle changes, but the new version certainly has depth! (and been scaled into a square)

From left to right, old icon vs. new icon.

From left to right, old icon vs. new icon.

The Future

Upcoming feature is a new “Recently Opened Documents” popover. This is reimplemented from a popover in GNOME Text Editor that performs the same function. Originally Setzer also borrows the popover from GNOME Text Editor too, but ever since, that app has updated/been overhauled, while this app has not.

It should look like this, like in GNOME Text Editor:

Recently Opened Documents popover in GNOME Text Editor.

Recently Opened Documents popover in GNOME Text Editor.

The Farther Future

I don’t know what’s the future for this fork/these commits. I do understand that when you accept a PR you must also accept maintaining it. Setzer uses a lot of hand-made UI solutions. Other GTK apps did this too but over the years the trend has been towards using default GTK widgets and patterns for stylistic consistencies. There are benefits to a hand-made solution, perhaps better syntax and/or performance, but so far these solutions have made the UI look worse. Again, don’t know how it is on Debian, but over here on vanilla GNOME it looks “pretty bad”. My forks so far have only addressed some of these issues, and there are a lot more to cover. Don’t know if I can make an adapter between custom API and default GTK API, a reconcilation?

Otherwise, this fork cannot run side-by-side with main repo forever.

Cheers. :-)



A weblog of Le Nguyen Gia Bao.
Powered by Jekyll. Forked and heavily modified from jekyll-theme-WuK.