pop-os / cosmic-settings

COSMIC Settings
GNU General Public License v3.0
164 stars 109 forks source link

Dark theme doesn't apply to GTK3/Qt #617

Closed fulalas closed 1 month ago

fulalas commented 1 month ago

Although the system is set to dark mode by default, GTK3/Qt applications (haven't tested GTK4) don't have dark theme applied.

mmstick commented 1 month ago

Do you have adw-gtk3 installed?

fulalas commented 1 month ago

Yes. If I manually run gsettings set org.gnome.desktop.interface gtk-theme "Adwaita-dark" it works straightaway.

mmstick commented 1 month ago

You need to install adw-gtk3, and ensure that cosmic-settings-daemon is running.

fulalas commented 1 month ago

As I told you, adwaita-dark is installed and it works if I manually run gsettings set org.gnome.desktop.interface gtk-theme "Adwaita-dark". Also, cosmic-settings-daemon is running. Take a look (that's before running gsettings):

screenshot-2024-09-27-17-42-19

This is running master built today.

Drakulix commented 1 month ago

gsettings set org.gnome.desktop.interface gtk-theme "Adwaita-dark".

This changes the whole GTK-theme, which COSMIC won't do, if you don't enable the experimental GNOME-apps setting.

What should be changed by cosmic-settings-daemon (which is why it is important, that it is running) is the color-scheme (gsettings get org.gnome.desktop.interface color-scheme).

Any theme supporting both schemes (e.g. the standard "Adwaita") should switch on the fly.

We also support the color-scheme portal (though I am not sure that affects GTK3 or only GTK4, but it should affect QT) for that xdg-desktop-portal-cosmic needs to be running. Is it on your system?

mmstick commented 1 month ago

cosmic-settings-daemon sets the GTK3 theme to adw-gtk3{,-dark} if installed and GNOME theme support is enabled. The adw-gtk3 theme inherits the libadwaita/GTK4 color scheme.

Drakulix commented 1 month ago

cosmic-settings-daemon sets the GTK3 theme to adw-gtk3{,-dark} if installed and GNOME theme support is enabled. The adw-gtk3 theme inherits the libadwaita/GTK4 color scheme.

Yes, these remarks where just about the case, where that setting is disabled. All the code is in place to still be able to have dark/light modes apply correctly across various toolkits without syncing the whole theme.

equeim commented 1 month ago

For Qt you need to set QT_QPA_PLATFORMTHEME=xdgdesktopportal environment variable, and possibly install additional package depending on a distro.

fulalas commented 1 month ago

OK, I see now what is wrong. The Adwaita theme can also be called 'Adwaita' / 'Adwaita-dark' (notice the 'd' in lower case). Source: https://gitlab.gnome.org/Archive/gnome-themes-extra/-/blob/master/themes/Adwaita-dark/index.theme.in?ref_type=heads#L6

I can confirm running gsettings set org.gnome.desktop.interface gtk-theme 'Adwaita-dark' changes my GTK3 applications theme to dark, but gsettings set org.gnome.desktop.interface gtk-theme 'adw-gtk3-dark' has no effect.