Yaru: Allow to switch between light and dark shell themes

Created on 4 Sep 2019  路  7Comments  路  Source: ubuntu/yaru

According to the discussion in Discourse from https://discourse.ubuntu.com/t/yaru-next-move/12155/45?u=memeplex onwards (up to comment 55) and also to a previous, related, Launchpad discussion in https://bugs.launchpad.net/ubuntu/+source/yaru-theme/+bug/1832137, I would like to propose a simple way to fix two issues, one of them maybe just temporarily (in case upstream eventually decides to add a global dark mode toggle) but in any case easily reversible:

  1. It's currently not possible to switch between a light and a dark shell theme, even if both are easily generated from sources (switching $variant from "light" to "dark").

  2. It's currently not possible to use Adwaita in an Ubuntu session nor is it possible to use Yaru in a vanilla Gnome session.

Both problems are related to the status of Yaru and Adwaita as session defaults, hence residing at /usr/share/gnome-shell/theme/(Yaru|Adwaita)/gnome-shell instead of /usr/share/themes/(Yaru|Adwaita)/gnome-shell. So if you enable the stock User Themes extension you end up seeing just one of them (according to the type of session you're in) as a Default entry in the shell theme selection dropdown.

Now, it's common practice for almost every other theme out there (most of which don't have the honor of being a distro or desktop default) to provide many versions (light, dark, darker, compact, etc) of both gtk and shell themes. For example, for Materia you get a plethora of themes (12!):

/usr/share/themes/Materia(|-dark|-compact|-dark-compact|-light|-light-compact)/gtk-3.0/gtk.css

and

/usr/share/themes/Materia(|-dark|-compact|-dark-compact|-light|-light-compact)/gnome-shell/gnome-shell.css

Even if it's nice to get Yaru by default, the current situation is too limiting in both aspects mentioned above:

  1. People using gnome-session in Ubuntu have access to any packaged theme except for, of all, Ubuntu theme!

  2. Even if upstream enabled a dark theme switch, you might prefer to provide light, dark, darker themes (there were recent discussions about this in Discourse), or even compact ones (Materia compact is very nice, indeed).


I suggest to generate both light and dark shell themes css in /usr/share/gnome-shell/theme/Yaru/gnome-shell and to provide symlinks to both variants as /usr/share/themes/Yaru(|-dark)/gnome-shell/gnome-shell.css. This way you get in the shell theme dropdown three options:

  1. Default
  2. Yaru
  3. Yaru-dark

The fact that Default is an alias to Yaru might be distressing for some people (not for me). But in a gnome-session, Default = Adwaita, so you get full choice. If you don't care about this, just provide a symlink to Yaru-dark, so you get:

  1. Default
  2. Yaru-dark

Alternatively, you can deploy the real thing into /usr/share/gnome-shell/theme/Yaru(-dark)/gnome-shell and provide just one symlink for the default in /usr/share/gnome-shell/theme/Yaru/gnome-shell/gnome-shell.css`. I think this solution is cleaner, since it's a standard practice to symlink to defaults or to selected options. Still, it diverges a bit more from upstream than the previous alternative.


At first sight this task looks like a mix of packaging and theme generation. But since git support symlinks I think that carefully created relative symlinks might be directly added to the repo so that they are packaged and installed automagically.

GNOME-shell

Most helpful comment

Hi @liubomirwm, thank you for your interest in this issue, I appreciate it, but in general I believe it's better if you express matters of opinion, those non technically related to the issue at hand, by just adding a thumbs-up above, so that the ticket ranks higher. +1 comments tend to bug developers instead.

All 7 comments

CC @3v1n0 @didrocks who made the session stuff in the beginning of the unity->gnome3 transition - maybe they could share their thoughts on this

Funny observation... :

when you switch to high contrast via the high contrast panel indicator in eoan, the shell theme switches to our dark variant :smiley_cat: (sadly, it also switches to high contrast adwaita gtk and icon themes)

+1 for dark shell! Dark theme is called D.A.R.K for a reason. It's not any good now, previously on Disco it used to match the theme without any extensions installed, let alone themes. It is even more bad than having a white theme and dark calendar/top menus.

Hi @liubomirwm, thank you for your interest in this issue, I appreciate it, but in general I believe it's better if you express matters of opinion, those non technically related to the issue at hand, by just adding a thumbs-up above, so that the ticket ranks higher. +1 comments tend to bug developers instead.

I tried a different way in #1578.
The dark variant is installed directly in /usr/share/themes/Yaru-dark, since I think there is no need to install it in /usr/share/gnome-shell (light is still the default)
The light variant is installed in /usr/share/gnome-shell and symlinked in /usr/share/themes/Yaru-dark

This way, according to my tests, User themes extension shows 3 options

  • default
  • Yaru
  • Yaru-dark

in both Ubuntu and Vanilla sessions. The first has default==Yaru, while in the latter default==Adwaita

I like the approach. Just for the sake of symmetry, wouldn't it be preferable to install both themes alongside in /themes and then symlink the default one to /gnome-shell? Does that make the installation more difficult or cause more divergence wrt upstream?

That's a good point, I'm just unsure whether it makes some problem but I can investigate

Was this page helpful?
0 / 5 - 0 ratings

Related issues

matthewpaulthomas picture matthewpaulthomas  路  3Comments

Feichtmeier picture Feichtmeier  路  3Comments

Feichtmeier picture Feichtmeier  路  3Comments

sicklylife-jp picture sicklylife-jp  路  3Comments

Feichtmeier picture Feichtmeier  路  3Comments