-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Propose desktop integration #48
base: master
Are you sure you want to change the base?
Conversation
This now can use inkscape or convert. Also, fixed the name provided to the resource to leave Fyne knowing the correct mimetype.
Some GTK application uses "view" inside window that are actually what we get with `view_bg_color`. This can be useful to use this color mode if we have a "framed" mode of views (work in progress).
We need to find "Adwaita" in the name, not the exact string. For window decoration, it is mandatory for user to set legacy application theme in gnome tweak tools.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this. I just had a very quick look through and noticed a few things that can be improved :)
theme/desktop/kde.go
Outdated
return | ||
} | ||
// the fontline is in the form "fontline,size,...", so we can split it | ||
fontline := strings.Split(k.fontConfig, ",") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you might want to use strings.SplitN
here given that you only care about the two first ones
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, done 😄
theme/desktopEnvironmentLinux.go
Outdated
switch wm { | ||
case "gnome", "xfce", "unity", "gnome-shell", "gnome-classic", "mate", "gnome-mate": | ||
return desktop.NewGnomeTheme(-1, desktop.GnomeFlagAutoReload) | ||
case "kde", "kde-plasma", "plasma": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want "lxqt" (if that it their exact string in this case) in there as well. I believe it is relatively widely used :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed 😄
The variant should be calculated by the work made at fyne-io/fyne#3414 So, we can now only get colors and icons from the applied theme in Gnome or KDE.
Just to mention, now that fyne-io/fyne#3414 is in progress, we should not try to detect variant. At least, the way I did it earlier in this proposition. For KDE, the theme is taken from For Gnome, the theme is parsed from IMHO, later, we need to propose an Adwaita theme. That's a pity for Linux users, but the futur Fyne version changed the color scheme. Later, when Fyne 2.2 will be outdated, we have some new colors to parse (overlay colors, and so on) |
If you are looking at the possible changes of a Fyne update then hold on - 2.3 is due in a week or so. |
@andydotxyz I actually changed this in my local environment, I mean that the theme change detection is now removed, but I just discovered something that will be complex to manage. Explanation of the problem, and possible resolution: Gnome changed so many things that this is very complicated to follow. Gnome 43 (and partially Gnome 42) is now using libAdwaita. There is a few changes of color scheme between versions, but that's not the problem. The issue is that this PR uses Gnome installs a GTK Adwaita theme to make it possible for legacy GTK applications to follow the Gnome theme. But it is not directly bound to Gnome. The change should be made manually... And, so, my current PR make Fyne applications to be managed as a "legacy GTK application". I've got a solution that works locally:
Then, loading
I also added some "options", to select what we can grab from the theme (icons, font, scaling, all) This works great, but there are tricky things I've made. |
Oh, I think I was wrong in the way I saw it working. Older applications, based on GTK 3 or 4, have an associated theme. Either, by default, Adwaita (light), or a theme installed by the user. So, in fact, my idea is not a bad one. Only, we have two solutions, and I think that's pretty much how we should look at it:
|
Yup, that was my understanding too - they ripped out theming and (only very recently) allow theme-like CSS overrides to placate some devs that need more control. |
This is a first attempt to have a desktop integration theme.
I made more tests on Gnome than KDE, it works at least with Gnome 40 and 42. Best results with Adwaita themes (light or not).
The theme also reacts on settings changes (gsettings, using dbus).
For icons, there are many problems that can happen because rasterX package is not able to parse everything. To fix the issues, I detect the installation of Inkscape or ImageMagick and I temporarily convert problematic icons to PNG. That's very fast.
The example in
cmd/desktop_demo
shows some widget and file view (to see that the file/dir icons are taken from Gnome or KDE icon theme).It "just work", but I'm of course open for suggestions
PS: I will add the documentation and screenshot in README.md later.