First snap attempt: GTK2 Issues (Transmission Remote GUI)

Hi there,

Please forgive my newness in this post. I’ve been working on trying to package Transmission Remote GUI (aka transgui) as a Snap, but I’m running into a lot of issues with GTK2 theming that I can’t solve easily.

I have tried to follow the guide in the docs and the accompanying thread but I’m struggling to make things work.

The Snap builds successfully, but the app runs with the same “Windows 98 era window scheme” that I’ve seen discussed in other threads recently.

Most of my other experimentation has involved stalking the Snapcrafters GitHub for signs of other GTK2 apps and attempting to lift bits from their yaml files to get things to work. Nothing I have tried seems to work unfortunately. I’ve tried so many things at this point that I’m losing track of what I have actually tried.


My current snapcraft.yaml file is below. I’m aware that I’m almost certainly connecting too many plugs for this kind of app, and the .desktop file, icons and launchers and other such cosmetic stuff still needs sorting out, but I was going to handle that later after solving the theming issue.

I’m not looking for someone to hold my hand through creating the entire Snap as I’m wanting to learn how to do this myself, but if anyone has any clues or could point me in the right direction on how to fix the theming that would be great!

name: transgui
version: 5.18.0
grade: stable
summary: A feature rich cross platform Transmission BitTorrent client.
description: |
  Transmission Remote GUI is feature rich cross platform front-end
  to remotely control Transmission daemon via its RPC protocol.
  It is faster and has more functionality than builtin Transmission
  web interface.
confinement: strict
base: core18

- build-on: amd64
- build-on: i386

    command: transgui

    plugin: dump
      - on amd64:$SNAPCRAFT_PROJECT_VERSION/transgui-$SNAPCRAFT_PROJECT_VERSION-x86_64-Linux.txz
    source-type: tar
      - libx11-6
      - libcairo2
      - libssl-dev
      - libatk1.0-0
      - libgtk2.0-0
      - libglib2.0-0
      - libpango-1.0-0
      - libgdk-pixbuf2.0-0
      - desktop-gtk2

    source-subdir: gtk
    plugin: make
    make-parameters: ["FLAVOR=gtk2"]
      - build-essential
      - libgtk2.0-dev
      - libxkbcommon0  # XKB_CONFIG_ROOT
      - ttf-ubuntu-font-family
      - dmz-cursor-theme
      - light-themes
      - adwaita-icon-theme
      - gnome-themes-standard
      - shared-mime-info
      - libgtk2.0-0
      - libgdk-pixbuf2.0-0
      - libglib2.0-bin
      - libgtk2.0-bin
      - unity-gtk2-module
      - locales-all
      - libappindicator1
      - xdg-user-dirs
      - ibus-gtk
      - libibus-1.0-5

  # For file picker demo
  avahi-observe: # Non-A/C
  mount-observe: # Non-A/C
  removable-media: # Non-A/C

  # Common graphical application resources

  # On a Wayland session, GTK instead uses the GSettings API to read the users preferences directly, bypassing the display server. So plugging the gsettings interface is also necessary.
  # Allowing GTK to detect the selected system theme - How to use the system GTK theme via the gtk-common-themes snap - doc -

  # For networking

    interface: content
    target: $SNAP/lib/gtk-2.0
    default-provider: gtk2-common-themes
    interface: content
    target: $SNAP/data-dir/themes
    default-provider: gtk-common-themes
    interface: content
    target: $SNAP/data-dir/icons
    default-provider: gtk-common-themes
    interface: content
    target: $SNAP/data-dir/sounds
    default-provider: gtk-common-themes

As an aside, there is a snapcraft.yaml file in the root of the transgui GitHub repo which I know of. Snap support has been worked on before by the devs, but they got stuck wrestling with the same GTK2 issue as I have and it isn’t finished or published in the store. I can’t post more than 2 links in this post as a new user, but the GitHub issue can be found by searching “snap” in the repo.

Thanks for any help anyone can provide :slight_smile:

Try adding the following to see if it makes any difference:

  GTK_PATH: $SNAP/lib/gtk-2.0
1 Like

Thanks! But sadly I don’t think this has made any difference.

For some additional info, when I run transgui in a terminal after building and installing the Snap (whether or not I try the fix above), I get a number of GTK-related errors which I’ve found hard to diagnose.

There are a lot of repeated lines showing the same error:

(transgui:33945): Gtk-CRITICAL **: 19:29:46.549: IA__gtk_widget_realize: assertion 'GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

And this error is printed just as the app finishes initialising:

(transgui:33945): GdkPixbuf-WARNING **: 19:29:46.827: Cannot open pixbuf loader module file '/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders.cache': No such file or directory

This likely means that your installation is broken.
Try running the command
  gdk-pixbuf-query-loaders > /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders.cache
to make things work again for the time being.

Finding anything concrete about that one online is pretty difficult. At first the obvious culprit is a missing libgdk-pixbuf2.0-0 package, but this has been part of my stage_packages stanza since the beginning.

You have this set in your apps: block:

    command: transgui

This won’t set the library paths and other desktop-related stuff for your app via the desktop-launch script that you added with the desktop-gtk2 part. Instead, change it to:

    command: transgui
      - bin/desktop-launch

That should fix your missing libgdk-pixbuf

1 Like

This solved it. Thank you!

I have the GTK2 theme working now.


Now I can clear up the plugs and sort the desktop lanucher and icons out and offer the final yaml file up to the devs.

Quick question, just in case you know, though I will research if not:

Some of the packages that I added to transgui's stage_packages section are now duplicated in the stage_packages section for GTK2. Do I need them in both sections, or can I remove them from the transgui section if the GTK2 section is providing them?

You can do either. I personally like to include all relevant packages for a part in that part. By doing that, and therefore duplicating some package definitions, I ensure that if I remove or modify one part it will not break another.

1 Like