libadwaita icon indicating copy to clipboard operation
libadwaita copied to clipboard

Support for user themes with GtkThemeFlutter

Open simrat39 opened this issue 4 years ago • 16 comments

So i'm writing this linux only plugin which uses method channels and gtk stuff to get the colors and stuff. I plan on supporting shadows, gradients and all that jazz so this is something to think about, we could have almost pixel perfect gtk apps with flutter

https://github.com/simrat39/GtkThemeFlutter

simrat39 avatar Nov 15 '21 04:11 simrat39

This method might be better then our previous attempt to support it by using using css.

@MalcolmMielle What do you think?

prateekmedia avatar Nov 15 '21 07:11 prateekmedia

@simrat39 I am moving this to an organisation, you can also add GtkThemeFlutter package to that (if you want).

prateekmedia avatar Nov 15 '21 08:11 prateekmedia

That looks good but that would fit better with the libadwaita package i just published than this one i think :). So we could integrate the colors directly in the material theme.

@simrat39 will your package still be compatible with the new libadwaita coming soon? The way that update is handled is so confusing to me :(

MalcolmMielle avatar Nov 15 '21 08:11 MalcolmMielle

@MalcolmMielle Flutter is still using gtk3, and libadwaita is gtk4 library, so that might not be possible.

prateekmedia avatar Nov 15 '21 08:11 prateekmedia

My question is more if GtkThemeFlutter is still going to work with the planned update to GTK and libadwaita in 6 months. Sorry if it's a stupid question @simrat39 I'm just not super familiar with it.

MalcolmMielle avatar Nov 15 '21 08:11 MalcolmMielle

@MalcolmMielle Yes, There will still be Gtk3 apps and themes, So this plugin will grab gtk3 theme from system until flutter switches to Gtk4 (Then we can modify code to get it from libadwaita).

prateekmedia avatar Nov 15 '21 08:11 prateekmedia

Would it be possible to integrate GtkThemeFlutter directly in adwaita and use it to fetch the theme values when on Linux while keeping the default adwaita colors for other platforms? That way, the gtk-flutter framework stays multi-platform?

MalcolmMielle avatar Nov 15 '21 08:11 MalcolmMielle

@MalcolmMielle Ofcourse, but let's first ask @simrat39, as GtkThemeFlutter is not published yet. So if sim can add this directly to adwaita.

Btw @MalcolmMielle your git config is really messed up, so your commits will not count for your account. Please correct it in ~/.gitconfig

prateekmedia avatar Nov 15 '21 08:11 prateekmedia

Afaik, libadwaita and how gtk does theming are two separate things, so the plugin should work even with gtk 4, as for moving it to the adwaita package, I would advise against it because it can have more usecases other than this. Maybe the adwaita package can use this plugin to get the theme or provide some helper functions to do so, idk not sure about that

simrat39 avatar Nov 15 '21 17:11 simrat39

I'm fine with your suggestion to keep them separated and to use GtkFlutterTheme in adwaita to fetch the user's theme if possible and propagate it to the user. That sounds viable to me. @simrat39 ping me when you think I can use it in adwaita :D. Thanks for the great work, I'll be very glad to get rid of manual theming!


AFAIU (god is theming complicated) libadwaita provides both the widget and the stylesheet:

The Adwaita stylesheet will be moved to libadwaita, including its variants such as HighContrast and HighContrastInverse. GTK will keep a copy of that stylesheet renamed Default, that will focus on the needs of vanilla GTK applications. See gtk!3079 and gtk#3582 for more information. We want that to happen early in the development of libadwaita.

For now, with flutter, we have adwaita providing the theme and gtk-flutter providing the widget. @prateekmedia maybe renaming the package to follow that convention later would be a good idea? Something like gtk-flutter -> libadwaita and adwaita -> adwaita.theme, for example?

MalcolmMielle avatar Nov 15 '21 18:11 MalcolmMielle

@MalcolmMielle yes it provides the default stylesheet, which can be overriden by user themes, and then read by gtk and provided to us, so it shouldn't be much of an issue

simrat39 avatar Nov 15 '21 19:11 simrat39

@prateekmedia could you give me proper perms in the org? i cant seem to rename the plugin repo

simrat39 avatar Nov 15 '21 23:11 simrat39

@prateekmedia I'm going to jump on this thread to ask for the same thing, to rename libadwaita to something more fitting ;)

MalcolmMielle avatar Nov 15 '21 23:11 MalcolmMielle

@prateekmedia could you give me proper perms in the org? i cant seem to rename the plugin repo

Sorry for being late, it was sleeping time here in India. I have given you Admin permissions in GtkThemeFlutter, also could you rename it to something useful?

prateekmedia avatar Nov 16 '21 01:11 prateekmedia

@MalcolmMielle I have given you admin to libadwaita, now you can rename that to adwaita.theme.

prateekmedia avatar Nov 16 '21 01:11 prateekmedia

@prateekmedia could you give me proper perms in the org? i cant seem to rename the plugin repo

Sorry for being late, it was sleeping time here in India. I have given you Admin permissions in GtkThemeFlutter, also could you rename it to something useful?

no problemo, i'm not too good with names so i'll go with 'gtk_theme_fl'

simrat39 avatar Nov 16 '21 02:11 simrat39