Yaru theme not working correctly with gtk2 snaps

On my Ubuntu 20.04 install, the theme I was using was working fine with my gtk2 application (which follows our docs) but then I switched to the Yaru theme and the gtk2 app has the old default styling. Wondering if this was local to my snap, I then tried gtk2-demo and found it was also affected by this issue. This is easily replicated with:

$ sudo snap install gtk2-demo
$ gtk2-demo

Change the ‘Applications’ theme via gnome-tweak to Adwaita or Ambiance (for example) and gtk2-demo (and my application) is correctly themed. Change it to Yaru and it is not.

$ snap list gtk2-demo gtk-common-themes gtk2-common-themes
Name                Version  Rev   Tracking     Publisher   Notes
gtk-common-themes   0.1      1499  latest/edge  canonical✓  -
gtk2-common-themes  0.1      12    latest/edge  canonical✓  -
gtk2-demo           2.24.30  12    latest/edge  jamesh      -

$ snap connections gtk2-demo
Interface               Plug                      Slot                              Notes
content[gtk-2-engines]  gtk2-demo:gtk-2-engines   gtk2-common-themes:gtk-2-engines  -
content[gtk-2-themes]   gtk2-demo:gtk-2-themes    gtk-common-themes:gtk-2-themes    -
content[icon-themes]    gtk2-demo:icon-themes     gtk-common-themes:icon-themes     -
desktop                 gtk2-demo:desktop         :desktop                          -
desktop-legacy          gtk2-demo:desktop-legacy  :desktop-legacy                   -
x11                     gtk2-demo:x11             :x11

I think you this fixes it:

  GTK_PATH: $SNAP/lib/gtk-2.0

Either that or this does:


I have both of those set in audacity and I believe it is styled correctly…

In my snap, I have both of these:

  GTK_PATH: $SNAP/lib/gtk-2.0

So does gtk2-demo:

  GTK_PATH: $SNAP/lib/gtk-2.0

audacity is not styled correctly for me in an up-to-date focal install using yaru


The leafpad snap is properly themed, which is what I use as my test case.

For reference: https://github.com/kenvandine/leafpad-snap/blob/master/snapcraft.yaml

gtk2-demo is also working for me. I have gtk-common-themes and gtk2-common-themes from the candidate channel

OK, gtk-common-themes from edge is broken. Use either candidate or stable. I think the edge build comes from Yaru’s CI. I’ll check in with them to see what’s going on with that.

1 Like

try again :slight_smile: (I had only released it to beta. it’s now in stable)

I confirmed that using either stable or candidate works great. Thanks!

1 Like

@clobrano I think Yaru is publishing gtk-common-themes to edge from CI. The version being published in CI is missing quite a few fixes including the gtk2 variant of Yaru that’s built as part of the snap build.

This might be due to an error I made in a test PR. Is there any other way to trigger a new gtk-common-theme build?

I could just publish our latest build to edge to replace what’s there?

Do you not have an automated build that publishes?

1 Like

There’s a CI, but only when pushing to bionic branch

Excellent - thanks @lucyllewy

I could try now to push some update to bionic, and see if this trigger the correct rebuild of edge for both

EDIT: or, I could be a little smarter and trigger again the CI on bionic branch :roll_eyes:

I rebuilt gtk-common-themes with the content from the proper branch.