It started benign, it was labeled Newcomers, it felt like a good start into the Fractal NEXT codebase: Make Ctrl+K toggle the room search bar… I was so naive!
This first issue took me days. It was a task where the high-level idea is very easy, but the concrete idiomatic and robust solution is non-obvious. What followed was a lot of reading and learning of the concepts and the concrete application of general GTK4, its UI Builder, shortcut handling, GActions and GObject bindings.
With some time spent on the problem and the help of the awesome community at the Rust ♥ GNOME Matrix channel, I was able to tackle the issue in a way I was happy with.¹ Although it took a while, it should be noted that I went with all that hassle, because it seemed from the start like a good learning experience – and it was – but also does Fractal NEXT now have a very well thought out room search bar. So finally, behold:
I spent the next days learning more about the GTK4 and Adwaita widgets, as well as the inner workings of the Fractal NEXT codebase, toying around with some code.
Based on the room setting design of our trusted GNOME designer Tobias, I started working on turning the pictures into something interactive. For the design I wanted to stay close to the libadwaita widgets and their intended use, so that it gives GNOME users a consistent experience and we can get all the shiny features like searchable preferences for free. The result does in some aspects deviate from the draft, e.g. the members overview got its own tab, but the overall reaction from the community to it was positive. I expect we will go through some iterations before the room settings UI is actually finished – after all: nothing will break your code faster than getting it into the hands of actual users 😁
The next step will be tidying up the code to the point of a merge request and getting some feedback. I will now focus my time on wiring everything up and then get it out the door to face other parts of Fractal.
See you in the next blog post 👋
¹ My solution for implementing the search bar shortcut has a single logical place where the on/off state of the search bar is stored (and that is the search bar). The search button is simply bound to that state. To toggle the search bar, I use a PropertyAction which is installed to the window, but the place to link the Ctrl+K shortcut to the action is not at the window, but at the application level. Setting the shortcut there has the nice side effect of automatically populating the shortcut overview with the proper shortcut. I think that is a good way to do it 🙂