Default Snap Theme on MATE?

Hi there,

So, as I understand it, snaps will automatically source their theme from the gtk-common-themes snap if the current system theme is in there.

I’m using Ubuntu MATE with what amounts to a custom theme (Ambiance dark with blue accent). I don’t expect snaps to be able to use this theme, but I would like to know how to specify a default snap theme to something dark rather than the default Adwaita, which glares against my darker theme.

I encountered this OMGUbuntu article that discusses how to set a snap theme that is not contained in gtk-common-themes, but most any theme I would choose for this–Yaru Dark, Adwaita Dark–is in there, I imagine (though not sure? Cannot find list of themes this actually contains).

Any pointers?

I couldn’t find a public repo showing what’s contained in gtk-common-themes, but if someone can point me in the right direction, or otherwise share some insider knowledge as to what’s actually contained in that snap, it would be much appreciated. :heart:

https://gitlab.gnome.org/Community/Ubuntu/gtk-common-themes/-/blob/main/snap/snapcraft.yaml

Aha, thank you @James-Carroll! I didn’t try hard enough. :weary:

So, I’ve learned: Ambiant-MATE-Dark is in the gtk-common-themes snap. And when I select the normal Ambiant-MATE-Dark, snap apps use that theme.

Now, can anyone offer any pointers on:

  • How I can get snaps to use my actual blue Ambiant-MATE-Dark theme?
  • If that’s not possible, how I can get snaps to just use the regular Ambiant-MATE-Dark theme, which would be close enough?

You can try force the theme by setting the GTK_THEME variable, for example:

GTK_THEME=Adwaita:dark snap run gedit

You could make that default for applications by modifying their .desktop files exec= parameter. Anything already in the gtk-common-themes snap should be usable.

If you want to use the actual custom theme you have, you’d need to find a way to get it into the content snap that’s being used. You could create/modify your own gtk-common-themes snap and place your modified theme into it, while this’d likely work, I think it might come with the downside of not automatically connecting interfaces to your snaps, but you could fix that by using the snap connect similar to to shown in the OMG Ubuntu article manually.

As a quick example on messing with the themes snap

snap download gtk-common-themes
unsquashfs gtk-common-themes.snap -d gtk-common-themes
sudo snap try gtk-common-themes

At this point any changes to the gtk-common-themes folder will appear in consuming snaps (again, you might need to rerun snap connect manually now), so you could experiment with dropping in your custom theme replacement files or modifying them in the folder itself.

You could then try snap pack it back into a proper .snap file if you prefer, install it with sudo snap install gtk-common-themes.snap --dangerous, and hopefully things might work.

Admittedly this is a lot of effort, but fundamentally my impression of the problem is that the name of the theme is the only thing that matters, there’s no real concept of proper versioning or customisations. A more ideal fix could look like just forking your custom theme as e.g Ambiant-Mate-Dark-iamjameswalters and uploading it as a proper snap on the store, this way the future automatic theme support could help you out too.

1 Like

Thanks for your input here, @James-Carroll. Ultimately, I decided that it was worth it to just go ahead and package up my theme as a snap–and furthermore, all of the color variants that can be installed through the Welcome screen in Ubuntu MATE. Then I opened a pull request on the color themes repository, and after working with the developer there, he’s now packaged an Ubuntu MATE Colours snap!

This was timely work, too, since Firefox will be shipping as a snap in Ubuntu MATE 22.04.

So thanks for the motivation!

2 Likes

That’s great to see! I can see there’s still some issues actually getting the theme snap to “just work”, so I’ll pass on some insight on Github about how you might be able to proceed. I’m not incredibly versed with themes support but I think there’s easy gains to be made yet!