I’m porting some multi-platform (Linux+Windows) apps from gtk+3 to gtk4. I noticed that many gtk4 apps also started using libadwaita.
Does libadwaita bring any benefit for multi-platform apps?
From what I could see, libadwaita is a visual API tuned for GNOME (and derivatives like Librem/Posch), and relies on portals for some settings like dark mode or accent color. Am I right?
What is the behavior on platforms where portals are not present, like win32? Does it fallback on configurable defaults, like gtk does with its “settings.ini”?
Also, I’m wondering why it was decided to go this “GNOME-only-plus-portal-tweaks” way, wouldn’t have it be better to create something like a “libvisual-gnome” library instead, so other devs could create drop-in “libvisual-e17” or “libvisual-win32” platform-specific equivalents?
No, Libadwaita has native implementations for the dark mode setting on Windows and MacOS, it does not use portals on those systems.
I am not sure what extra benefits you might be thinking of here, if you are comparing to something like Qt or Flutter, etc. The benefit of multi-platform is if you like the development style then you can use that to build the same app on multiple systems.
ah, thanks for the info, this is indeed very nice!
About the potential benefits, when I think of a “multi-platform visual API”, I ideally expect some little tweaks to better match the platform’s UI.
I mean, not a complete new CSS styling, but for example, using the platform’s standard minimize/maximize/close control buttons style instead of the GNOME one. Or using square corners instead of rounded ones for windows under Windows10.
In general, anything that would help the apps to look and behave more native/integrated.
There is no such thing, every platform has a set of designs that are incompatible with each other, e.g. Windows expects you to use a toolbar or ribbon, MacOS expects you to use the global menubar, GNOME expects you to use the headerbar, KDE expects you to use a non-global menubar and toolbar, I could go on here…
For anything more than slightly, there is no way for this to work really, the appearance of the UI is completely dependent on the app. But it seems someone could create a small add-on library to libadwaita that changes a few small things like you mentioned, e.g. the window buttons and the corner rounding.
Anyway, I see what you mean. If you want to use the dark mode and high contrast implementations in libadwaita then that could be a reason to use it, otherwise you will have to reimplement all that code for Windows and MacOS and also for the portal, or at minimum copy it out of libadwaita.