lassekongo83 / adw-gtk3

The theme from libadwaita ported to GTK-3
GNU Lesser General Public License v2.1
1.48k stars 55 forks source link

Dark theme is Gtk3 Adwaita stylesheet in some Flatpaks #101

Closed winkelnp closed 2 years ago

winkelnp commented 2 years ago

In some flatpaks (like org.gnome.Evince or org.gnome.Lollypop) the dark theme shows up as the old adwaita style.

I do not have org.gtk.Gtk3Theme.Adwaita-dark installed, it is only your two flatpak themes and my Gtk3 theme is adw-gtk3(-dark).

Is this intended behaviour/ repeatable on your end? if not, what can I do?

Thanks for your help.

Top panel of org.gnome.Lollypop : dark image light image

lassekongo83 commented 2 years ago

I can reproduce, but I have no idea why it happens.

@dusansimic Any idea? Could it be because of the line rm adw-gtk3/gtk-3.0/gtk-dark.css in https://github.com/flathub/org.gtk.Gtk3theme.adw-gtk3/blob/master/org.gtk.Gtk3theme.adw-gtk3.yaml ?

You can get the apps to use the dark theme though. If you installed the the theme in ~/.local/share/themes:

sudo flatpak override --filesystem=$HOME/.local/share/themes
sudo flatpak override --env=GTK_THEME=adw-gtk3-dark
dusansimic commented 2 years ago

I was able to reproduce this on Lollypop (neither light or dark theme are working). I however don't think at the moment that this is the packages fault because it works as expected on many other gtk3 flatpak apps (GTG, Pitivi, all Electron apps...).

Could it be because of the line rm adw-gtk3/gtk-3.0/gtk-dark.css

That line removes the dark theme css from light theme package because if it is left there and light theme is selected in gnome tweaks, it uses the dark theme for some reason. The dark theme is in the adw-gtk3-dark package and that one is loaded when dark theme is used.

I'll take a look at possible problems when I find time.

winkelnp commented 2 years ago

flatpak override resolves the issue, but then the apps don't follow system dark/light theme... (i know that's intended function)

Is this maybe an issue with how flatpak recognises GTK themes as opposed to the system dark theme? Maybe the system dark theme setting overrides any GTK themes that might have been set

daudix commented 2 years ago

Same thing, gnome web, flatseal & bottles have same issue (flatpak)

lassekongo83 commented 2 years ago

@dusansimic I've narrowed it down to that it in fact was the missing gtk-dark.css file. It is that file some applications use when switching between light/dark in gnome-control-center. If it is missing the app will default to classic Adwaita. It should be present in both the light and dark theme (even if it's a duplicate of gtk.css in the dark theme.)

Test it by downloading the tarball:

  1. Extract the themes to different named folders in ~/.local/share/themes. For example test-light, test-dark.
  2. Select test-dark in gnome-tweaks.
  3. Remove gtk-dark.css from test-light.
  4. Select dark in gnome-control-center.
  5. Open a GTK3 libhandy application like nautilus. It should now use classic Adwaita.
ghost commented 2 years ago

@dusansimic I've narrowed it down to that it in fact was the missing gtk-dark.css file. It is that file some applications use when switching between light/dark in gnome-control-center. If it is missing the app will default to classic Adwaita. It should be present in both the light and dark theme (even if it's a duplicate of gtk.css in the dark theme.)

Test it by downloading the tarball:

1. Extract the themes to different named folders in `~/.local/share/themes`. For example `test-light`, `test-dark`.

2. Select `test-dark` in `gnome-tweaks`.

3. Remove `gtk-dark.css` from `test-light`.

4. Select dark in `gnome-control-center`.

5. Open a GTK3 libhandy application like nautilus. It should now use classic Adwaita.

so how do we fix this

lassekongo83 commented 2 years ago

so how do we fix this

Simply wait for it to be fixed in the flatpak packages. I'm not the one maintaining it.

dusansimic commented 2 years ago

@lassekongo83 thanks for that info! I had some troubles when adding both gtk.css and gtk-dark.css to the dark theme iirc so that's why I removed it from the dark theme (just renamed the gtk-dark.css to gtk.css). I'll look into it tonight or tomorrow. And see if I can fix it.

dusansimic commented 2 years ago

On my machine, with the 2.0 update, everything seems to work fine. Once the update gets propagated to flathub, it should probably work. Let's keep this issue open just in case.

FiestaLake commented 2 years ago

This still happens in v2.0 with flatseal (flatpak) app.

daudix commented 2 years ago

@FiestaLake flatpak theme is not updated for now, wait when it will update, because issue already fixed (I hope)

FiestaLake commented 2 years ago

@FiestaLake flatpak theme is not updated for now, wait when it will update, because issue already fixed (I hope)

I think it already got updated a day ago.

winkelnp commented 2 years ago

Update to 2.0 was pushed to the flathub version on the 31st of May

daudix commented 2 years ago

Yes, I checked out, flatpak theme is updated but bug is still there, I have it in epiphany and flatseal, other gtk3 apps like dialect, curtail, fractal, etc is look normal

STBoyden commented 2 years ago

Can confirm, also experiencing this issue with multiple Flatpaks.

winkelnp commented 2 years ago

I get the feeling it affects more flatpaks now than before...

BigmenPixel0 commented 2 years ago

Can confirm this issue.

daudix commented 2 years ago

I noticed strange thing, when installing flatpak theme with stylepak there is no issues with not themed apps (flatseal, GNOME web, dialect, celluloid & etc)

dusansimic commented 2 years ago

I'm not sure why but for some reason everything works fine on my machine. I'm using Arch and have installed bot Flatpak theme and the system one (via the aur package). I've selected the system theme in Gnome Tweaks and the Flatpak theme is selected automatically after that.

user1-github commented 2 years ago

Same issue here. On Fedora Silverblue, the preinstalled utilities that still use gtk3, use the old dark Adwaita theme instead of adw-gtk3-dark.

lassekongo83 commented 2 years ago

@dusansimic Removing rm adw-gtk3/gtk-3.0/gtk-dark.css in https://github.com/flathub/org.gtk.Gtk3theme.adw-gtk3/blob/master/org.gtk.Gtk3theme.adw-gtk3.yaml will most likely fix the issue. That file is needed for gnome-control-center dark appearance setting to work (or gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark').

winkelnp commented 2 years ago

the latest update to the flatpak seems to have fixed it for me. Does anyone else see it fixed now? If yes I'd be happy to mark this as resolved

lassekongo83 commented 2 years ago

Run flatpak update org.gtk.Gtk3theme.adw-gtk3 to resolve the issue.

user1-github commented 2 years ago

@lassekongo83 The new update didn't fix it for me. Maybe something's wrong with my distro (Fedora Silverblue)? But I recieved an update only for the light variant, not for the dark one.

@winkelnp Can you check if it fixed Gnome apps like Image Viewer or Document Viewer? Because Gnome utilities like these are the only gtk3 Flatpak apps that I have and the update doesn't work on them.

lassekongo83 commented 2 years ago

@user1-github Do you have any GTK_THEME environment variable set? You may have to unset it. sudo flatpak override --unset-env=GTK_THEME

Did you set the dark theme in gnome-control-center > appearance > dark?

Also try relogging.

user1-github commented 2 years ago

@lassekongo83 I don't have any env variables set.

I've set up my theme in this order: -Set the dark appearance in gnome settings -Extract both light and dark non-Flatpak variants of the theme from the tarball to /.local/share/themes -Set the non-Flatpak variant with this command: gsettings set org.gnome.desktop.interface gtk-theme 'adw-gtk3-dark' -Install both light and dark variants of the Flatpak theme.

Rebooting also didn't fix the issue after the update.

lassekongo83 commented 2 years ago

@user1-github I just noticed you mentioned Document viewer. That is a GTK4 app, so you'll need to extract the libadwaita theme for that. I have instructions on that, but not for Silverblue.

I also got the Image viewer to use the theme when I put it in ~/.themes instead of ~/.local/share/themes. Must be something Silverblue specific.

user1-github commented 2 years ago

@lassekongo83 It works, thanks! After I moved the themes to ~/.themes, both the Image Viewer and Document Viewer Flatpaks started using the adw-gtk3-dark theme.