GTK4: GtkStatusbar

Hi,

in GTK4 a GtkStatusbar contains the functions gtk_statusbar_push and -pop to show some text.
However I would like to implement a statusbar which has e. g. 3 different sections to show some
text. What is the preferred GTK4 way to implement such a feature.
I would also like to know if the the small triangle in the left bottom corner to re-size the window is still
available.

I believe in this case implementing a custom control is preferable. To begin with, copy the status bar implementation from GTK: https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkstatusbar.c, https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/ui/gtkstatusbar.ui

Mmh I don’t quite remember if that’s the case, run gtk4-demo-application and see yourself. If plain status bar has no resize grip, you can implement that using gdk_toplevel_begin_resize()

If you want custom behaviour, you will have to write a custom widget.

In general, though, I’d recommend using something like libadwaita’s Toast API to pop up in-app notifications instead of using a status bar.

The resize handle is not really useful, in this day and age; windows have invisible resize handles that extend outside the window border, to make it easier to resize without being pixel-precise.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.