Libhandy 1.2 just got released in time for GNOME 40, we recommend you to use this adaptive GTK widgets library in your apps targeting that GNOME version.
This article presents the most newsworthy changes, you can check the full list of fixes and improvements in the changelog.
Adaptive Sidebars
While HdyLeaflet
is a good candidate to implement panels which are different layers in the hierarchy of the model — e.g. a list of articles in the first panel, and the selected article in the second panel — it is not well suited for sidebars providing extra information on the current view, or for sidebars providing an overview of the current document. In these cases, the sidebar can be seen as an attachment to the view, not an upper or lower layer in the hierarchy.
To help implementing such sidebars, we created HdyFlap
which can have 3 children: a content, a flap, and a separator. Depending on the available size and the properties, the flap child can either be next to the content child or overlay it, and the separator can be put between the two or not. In the context of a sidebar, your view would be the content child, and your sidebar would be the flap child.
HdyFlap
can also be used to implement fullscreen headerbars: putting the headerbar on top of the window’s content when it is floating, and overlaying it when it is fullscreened. To do so, use HdyWindow
to have a unified window area, give it a vertical HdyFlap
, make your headerbar the flap child, and fold the flap when it’s fullscreened.
Tab Bar and Tab View
While GtkNotebook
is serviceable for a small and fixed number of tabs, it was showing its age for applications heavily relying on tabs such as web browsers, file managers and terminal emulators.
We introduce HdyTabBar
and HdyTabView
as a modern tab bar for such applications letting you pin tabs and scroll.
Status Page
Pages presenting a big icon, a big title, a description, and optionally some more widgets are often used to implement welcome pages, empty state pages, or error pages. Sadly each application was implementing them in their own way, leading to style inconsistencies not only between applications but also within a single application.
To help unifying their look across the whole ecosystem and to reduce the code needed to implement them a bit, we created HdyStatusPage
.
Improved Swipes
The swiping velocity is now calculated with a scroll history to make swipes more accurate and comfortable.
HdyCarousel
gained the ability to swipe through multiple children at a time, this can be activated via the allow-long-swipes
property.
The area used to detect edge swipes for HdyDeck
and HdyLeaflet
got increased to make these swipes easier to trigger.
Avatar
The loadable-icon
property has been added to allow setting a GLoadableIcon
as the avatar picture, simplifying setting the icon and deprecating the set_image_load_func()
method in its favor.
The draw_to_pixbuf()
and draw_to_pixbuf_async()
methods were added to allow exporting the avatar as a GdkPixbuf
, which is helpful to create notification bubbles e.g..
Action Row Wrapping
The title-lines
and subtitle-lines
properties were added to set the maximum number of lines the title and subtitle can take. Setting them to 0 means the number of lines won’t be limited, contrary to the previous single-line limit.
Deck and Leaflet Child Insertion
HdyDeck
and HdyLeaflet
received the prepend()
, insert_child_after()
, and reorder_child_after()
methods to help inserting children anywhere relevant.
Improved Keypad Entry
HdyKeypad
now allows pasting and erasing text in the entry, and beeps when an invalid character is typed.
About GTK 4
We have plans to support GTK 4 for GNOME 41, and that is what we will focus on for the next GNOME development cycle. I’ll write more about these plans in a following article.