DEV Community

Cover image for Forced Switching to Adwaita Light Theme
Naufan Rusyda Faikar
Naufan Rusyda Faikar

Posted on

Forced Switching to Adwaita Light Theme

Just another short story ...

I love theme Adwaita theme, especially the dark one. So, I always have it enabled by using GNOME Tweaks. Unfortunately, many applications do not seem to be worked pretty well in dark theme. So, I wanted to know how to run certain Flatpak application in light theme without me changing the global default theme.

In my case, WPS Office has a poor display of the font search dropdown list; black text on dark background will never be good. After googling for a while, I got to know that WPS Office was installed at /var/lib/flatpak/app/com.wps.Office/. It seemed like all Flatpak applications will be installed either at

  • /var/lib/flatpak/app/ for system-wide installation; or
  • ~/.local/share/flatpak/app for per-user installation.

Exploring the directory structure, I have realised that somehow WPS Office has included its own theme directory at /var/lib/flatpak/app/com.wps.Office/x86_64/stable/active/files/share/themes/.

$ cd /var/lib/flatpak/app/com.wps.Office/x86_64/stable/active/files/share/themes/
$ ls
Adwaita  Adwaita-dark  Default  Emacs  HighContrast  Raleigh
Enter fullscreen mode Exit fullscreen mode

I think, this is not common, at least not for most applications. Then, I idly experimented to remove the Adwaita-dark folder, so that WPS Office cannot find it anymore. Or at least just to rename it;

$ sudo mv Adwaita-dark/ Adwaita-dark-bk/
$ sudo mv Adwaita/ Adwaita-dark/
Enter fullscreen mode Exit fullscreen mode

Fortunately, it seemed to be worked. Yay! I have managed to force WPS Office to use the light theme instead! Although I cannot explain it.

For GTK applications, we can make sure to set the GTK_THEME environment variable. For example, for the Color Picker application:

$ sudo flatpak override --env=GTK_THEME=Adwaita nl.hjdskes.gcolor3
Enter fullscreen mode Exit fullscreen mode

To unset, just need to set the value to empty:

$ sudo flatpak override --env=GTK_THEME= nl.hjdskes.gcolor3
Enter fullscreen mode Exit fullscreen mode

For Qt applications, set the QT_STYLE_OVERRIDE variable instead.

You deserve a good day, bye!

Discussion (0)