Hacktoberfest! - Week 3

TheoForger - Oct 26 - - Dev Community

Another week (and a few more days) has gone by. While my work on the mattermost mobile app (#8260, #8278) is still on hold, I turned my attention back to Tiling Shell, as the maintainer finally reached out to me on my PR from 2 weeks ago.

Technically, not all work was done this week, but since I haven't talked about it that much, I'll start from the beginning.

Background

I've been a happy GNOME user since GNOME 40. As much as I love the simplicity of it, some aspects of this desktop environment feels a bit too bare-bone. For instance, the lack of support for a system tray has been bugging GNOME users for years. It can be solved with the AppIndicator extension, but it shouldn't be a problem in the first place.

With window tiling, GNOME by default only supports left/right edge tiling and maximizing. That's it. No alternative layouts, not even quarter tiling (when you drag a window to the corner of the screen). While the horizontal workspace is indeed powerful (still my all-time-favorite GNOME feature), some user just wants to have multiple windows organized on one screen.

Created by domferr, Tiling Shell is a GNOME extension that brings advanced tiling features from various desktops into GNOME. It supports edge/corner tiling as well as custom window layouts. You can tile a window in place by holding down Ctrl key (The KDE Plasma style) or dragging it to the widget on the top (The Windows 11 style). Here's an example of how I used it to test the app database when I was working on mattermost-mobile (Of course Android emulator is not responding 😂):

Showcase of my window layout using Tiling Shell

My Work

I took on this issue and added the feature to import and export user settings.

Having the experience as a GNOME user, I knew GNOME configurations are stored as dconf entries. Immediately, I had the idea to use the dconf dump and dconf load commands to export/import these entries. I shared this idea with the maintainer. He thought it was a good idea as well and assigned me this issue.

Setup

The setup was very easy. I installed the dependencies and used the nested Wayland session for debugging (god I love Wayland). Things just worked from there. Neat!

Nested Wayland session

The Small Challenge

For the most part, this feature implementation was straightforward. I added the UI elements, and then created another class to handle import/export. I used subprocesses from the Gio Library to run these dconf commands.

New UI elements for the new feature

The tricky part was the lack of a schema for the dconf entries (I'm not sure if it's even supported for GNOME extensions). In other words, no dconf entries are created until they are modified. If an option in the settings is untouched, it doesn't have an entry. These entries will be missing in the export file as well.

The solution? I made sure all settings are reset to default before the import, so the missing entries will always be at the default states.

The Big Challenge

Due to the nature of this program, it needs to override some system settings. When certain options are enabled, the program saves these system settings into a dconf entry, so that they can be restored later (Explained by the maintainer here).

My intuition told me to simply exclude this entry for the export, which I did, along with other irrelevant entries - It worked for the export, but importing would create a lot of conflicts with the overrides.

After some time studying the behavior, I implemented a workaround: Before import, turn off the settings related to overrides, which would restore them back to the system. Theoretically, after the import, overrides will be applied again.

In reality, that didn't happen. Turned out there were multiple bugs inside the original code, which was affecting the behavoir as well. I reported these bugs (here and here) back to the maintainer. He pushed a couple of fixes and even rewrote some other code. After a whole week of back and forth commits and discussions, things finally worked.

Conclusion

Overall, this was a really pleasant experience! The maintainer (domferr) has to be one of the nicest people I've encountered on the internet. He was very patient and encouraged me through every problem I encountered, while providing help along the way. I had a lot of fun working with him.

I also learned a lot about the GTK library. I think this will be very useful in the future since I've always wanted to create GTK/GNOME applications.

. . . . . . . . . . . . . .