Skip to content
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

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

Closed
fulalas opened this issue Sep 21, 2024 · 9 comments
Closed

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

fulalas opened this issue Sep 21, 2024 · 9 comments

Comments

@fulalas
Copy link

fulalas commented Sep 21, 2024

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

@mmstick
Copy link
Member

mmstick commented Sep 21, 2024

Do you have adw-gtk3 installed?

@fulalas
Copy link
Author

fulalas commented Sep 22, 2024

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

@mmstick
Copy link
Member

mmstick commented Sep 23, 2024

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

@mmstick mmstick closed this as completed Sep 23, 2024
@fulalas
Copy link
Author

fulalas commented Sep 27, 2024

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
Copy link
Member

Drakulix commented Sep 27, 2024

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
Copy link
Member

mmstick commented Sep 27, 2024

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
Copy link
Member

Drakulix commented Sep 27, 2024

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
Copy link

equeim commented Sep 28, 2024

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

@fulalas
Copy link
Author

fulalas commented Sep 28, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants