stackotter / swift-cross-ui

A cross-platform declarative UI framework, inspired by SwiftUI.
https://stackotter.github.io/swift-cross-ui/documentation/swiftcrossui/
MIT License
652 stars 36 forks source link

Support for libadwaita? #52

Open Its-Kenta opened 1 year ago

Its-Kenta commented 1 year ago

Is there any chance to add support for libadwaita on Linux? Or would that go beyond the vision of this project?

stackotter commented 1 year ago

I'd be happy to add support for libadwaita, the eventual aim is to have quite a few other backends other than Gtk, so libadwaita is well within the scope of this project. Someone else asked about this a while ago and I think they said that I would really only have to add one line to the project to enable libadwaita support on Linux? Would you also want certain libadwaita widgets to replace the Gtk ones? (I've never used libadwaita before, so I don't really know anything about it)

JCWasmx86 commented 1 year ago

Adding basic Libadwaita support is basically using adw_application_new instead of gtk_application_new. This uses at least the Libadwaita stylesheet, so it looks more like the other GNOME apps. The other widgets are more complementary and help following the GNOME HIG.

Its-Kenta commented 1 year ago

Was about to add my take on it but @JCWasmx86 beat me to it :)

stackotter commented 1 year ago

Adding basic Libadwaita support is basically using adw_application_new instead of gtk_application_new. This uses at least the Libadwaita stylesheet, so it looks more like the other GNOME apps. The other widgets are more complementary and help following the GNOME HIG.

Ok sounds good. For now I might make some way for people to select that they want to use adwaita on Linux, and just use that to decide how the application is created. Eventually I reckon I’ll probably make it a ‘separate’ backend option where the basic widgets are updated to use Adwaita’s widgets (if there are drop-in replacements). Any auxiliary adwaita widgets that don’t fit into the SwiftUI API can probably be vended as a separate target or package providing specific adwaita support for those who don’t want to be as cross platform (or are happy to put a bit more effort into being so).