GTK theming on Wayland

This utility will add the required changes to fix GTK applications’ styling when run under Wayland. This utility requires that your Snap is using the gnome-3-28 extension.

Usage with sc-jsonnet

Applying the utility with sc-jsonnet is the easiest method. To use, simply import the library and add wayland_gtk_theming() to your snapcraft tag. The following code shows a trivial example of using it:

local snapcraft = import 'snapcraft.libsonnet';
local wayland_gtk_theming = import 'https://raw.githubusercontent.com/diddlesnaps/snapcraft-utils-library/master/lib/wayland-gtk-theming.libsonnet';

snapcraft {
    name: wayland-gtk-theming-example,
    version: "0.1",
    summary: "Example of using the 'wayland-gtk-theming' library",
    description: |||
        This is my-snap's description. You have a paragraph or two to tell the
        most important story about your snap. Keep it under 100 words though,
        we live in tweetspace and your description wants to look good in the snap
        store.
    |||,

    base: core18,

    # Add the rest of your snapcraft build config here
}
+ wayland_gtk_theming()

Manually adding to snapcraft.yaml

Add the following parts into your snapcraft.yaml, and change my-part to a list of all of your snap’s other parts:

parts:
  # Ship a default set of GSettings schemas so that the correct theme is used
  # in Wayland sessions on Ubuntu (see https://forum.snapcraft.io/t/7806/3).
  desktop-settings-packages:
    after: [gnome-3-28-extension]
    plugin: nil
    build-packages:
      - libglib2.0-bin
    stage-packages:
      - gsettings-desktop-schemas
      - ubuntu-settings
    prime:
      - usr/share/glib-2.0/schemas/*

  desktop-settings-build:
    plugin: nil
    after: [my-part, desktop-settings-packages] # Make this part run last
    override-prime: |
      set -eux
      glib-compile-schemas usr/share/glib-2.0/schemas

Remember, that this library expects you to be using the gnome-3-28 extension.