5

I recently updated my Ubuntu to 24.04 (before I was on 23.10). I use the Mate desktop environment, but installed that as add-on to a "regular" installation (via the usual packages).

I like to use a dark theme. After the update the systems behaviour is strange: partially it appears in dark mode (e.g. when I open the Control Center), but other applications do not recognize that. E.g. Firefox (Snap) or App Center stay in light mode. Chromium on the other hand e.g. is in dark mode from the beginning, although I also set it to "device" mode.

But only until I open the "Appearance" settings from the Control Center - as soon as I start that all applications that were in light mode before immediately switch to dark mode. I do not have to click anything there, starting the settings is enough.

Applications that I described follow a mode change from light to dark and vice versa immediately. I tried that with switching from Yaru-MATE-dark to Yaru-MATE-light.

I have a Thinkpad P14s Gen3 laptop with Nvidia T550 dedicated graphics card. On the old install I used the Nvidia drivers 535.

I checked other questions like

Can I add some config or login commands to set the mode for all applications? As they recognize the correct mode, even if I start them first time (on a session) after I opened the Appearance settings, there has to be some persistent way.

UPDATE: @kanehekili posted a solution for several gnome apps like gnome-calculator.

Still the same behaviour (light theme by default until I start the Appearance settings with mate-appearance-properties) for applications like my browser (Firefox, installed as a snap) or the snap-store aka "App Center"

3 Answers3

2

On Ubuntu 24.04 LTS, I solved the issue by editing the /etc/environment file.

sudo nano /etc/environment Add the following line ADW_DEBUG_COLOR_SCHEME=prefer-dark to the end of the file. Save your changes then reboot your PC.

Further reading: The issue is related to GNOME libadwaita. Libadwaita controls your theme styles among other things.

Mwiza
  • 123
1

Using a Gnome derived desktop one must assume that "libadwaita" is the culprit. This library (the gnome-calculator and other are using it) provides a theming that does not comply with your settings - it simply ignores it.

To circumvent this, add the selected theme into your ~/.profile or ~/.bash_profile:

export GTK_THEME=MyFavoriteTheme

and restart your session (log out/in)

I also have written about this in my theme which supports GTK2,GTK3 and GTK4

Update on snap

As mentioned in the question, snap does not conform to any "external theme", it is like a third theme layer, only providing themes that are delivered with snap.

Since I don't use mate, I assume that mate apps may be configured somewhere else. The theme to use should support GTK3 and GTK4 (and mate may have even GTK2 remnants)

kanehekili
  • 7,426
1

Finally I figured out my problem and how to solve it:

With the help of this StackOverflow Answer to "Dark mode not applying on certain apps in Ubuntu 23.10" I found out that the relevant Gnome Setting that was still missing after @kanehekilis answer to this question was configurable by

gsettings set org.gnome.desktop.interface color-scheme prefer-dark

Next I figured out that some application reset that setting to prefer-light on every login. It turned out to be the "Ayatana Indicator for Display configuration", installed by the package ayatana-indicator-display. This is not contained in the standard install of Ubuntu Mate, but I picked it since I found it useful to be able to set screen sizes and orientations because I frequently switch workplaces with my Laptop.

And it turns out that this piece of software now (since the update) has not only a gsettings option to pick the preferred color scheme (dark or light), but even a UI to switch it, called "Theme profile":

Display indicator setting to pick color scheme

As soon as I set this to "dark", the Snaps finally show up in dark mode.

Still a big thank you to @kanehekili for explaining the GTK Theme setting by environment variables.