Setting Dark Theme for Certain Applications

Just upgraded to Fedora 41, and it seems that certain apps (I believe they’re all X11 apps) no longer respects the “Legacy Applications” theme option in Gnome Tweaks. As you can see in the image, VSCode’s title bar is white (which follows the system theme) instead of the “Legacy Applications” theme in Gnome Tweaks. In Fedora 40, VSCode follows the “Legacy Applications” theme correctly (setting Legacy Applications to Adwaita-dark causes VSCode, Discord, etc’s title bar to be dark).

I wanted my system theme to be in light mode, but apps like Discord and VSCode looks better in dark mode than light mode.

So what I ended up doing is that I set my system theme to light mode and I set the Legacy Applications theme to Adwaita-dark. In Fedora 39 and Fedora 40, this workaround, for the most part, got me what I wanted - certain apps I’m used to being in dark mode showed the correct dark title bar. Unfortunately, in Fedora 41 (GNOME 47), X11 applications no longer respect this legacy theme option. I suspect this only happens to X11 apps, since launching VSCode using code --ozone-platform=wayland . launches VSCode correctly with the correct title bar theme.

But of course, this is just a workaround. Ideally, I’m trying to find a way to launch let’s say launch certain specific apps like VSCode, Discord, etc. in dark mode, while keeping all other apps in light mode. In other words, I’d like to be able to set certain applications to dark mode while having my system theme set to light mode.

After reading a bunch, I saw that you can use the GDK_THEME environment variable. Unfortunately, I’ve tried setting the environment variable GDK_THEME=Adwaita:dark and this doesn’t seem to work.

Anyone have any suggestions?

There’s really 2 approaches I can think of and either approach is okay: either somehow getting dark theme to work on a per application basis (for X11 apps) or having X11 apps respect the Legacy Applications theme.

Also if it’s helpful, I’m running Fedora 41, on Wayland, with NVIDIA PRIME (proprietary drivers).

Yeah, I have gnome-themes-extra installed already, so this isn’t the issue. Also, I tried installing both of them, still doesn’t work.

Can confirm that this works perfect on a upgraded F40 to F41 system.
What I do also is set in Settings/Appearance/Style>>Dark

Then as proposed in gnome tweaks “Legacy Applications” Adwaita-dark

@wwwysch have you tried with a reboot and or a log out/log in ?

1 Like

Settings >> Appearance >> Dark sets the system theme to Dark mode. Yes, this does set VSCode’s title bar to Dark mode. Problem is I want the system theme to be in Light Mode (since I find that most GNOME apps like Settings, Nautilus, etc. better in light mode) but I want certain apps like VSCode and Discord to be in dark mode.

In F40, setting Legacy Theme to Adwaita Dark, but setting the system theme to light mode does what I want - everything is in light mode except (X11 GDK) apps like VSCode and Discord are in dark mode. But this approach doesn’t work anymore in F41. So I’m wondering if there’s any way to custom set certain applications to dark mode, but have the default theme set to light mode.

I confirm that with F40 the mentioned apps (VSCode, Discord) are following system legacy theme, but not with F41.

However, legacy GTK apps do follow system theme both under F40 and F41. The apps mentioned are not not legacy GTK apps but rather Electron apps, so I would say the new behaviour is related to Electron apps only.

3 Likes

Ah yeah you’re right, perhaps this is due to Electron apps using legacy theme over system them on F40. Now the problem is whether there’s any way to get Electron apps to use dark mode on F41 without having to change the system theme.

The aforementioned apps require the same runtime (org.freedesktop.Platform branch 24.08) on both F40 and F41. Maybe the runtime needs an update to integrate better with GNOME 47?

1 Like

Aha, finally solved it. I went down looking at GNOME 47 release notes and saw that Mutter is responsible for XWayland Scaling (which is somehow similar to this). Then I looked at the release notes, and from there found the MR I’m looking for.

MR 3981

Not 100% sure what that issue is fixing (perhaps the fact that X11 apps are using the legacy theme), the solution seems to be adding MUTTER_FRAMES_PLATFORM_LIBRARY=none to /etc/environment, then logging out and logging back in. Anyways thanks for all the help!

3 Likes