Plex-desktop on wayland (cc: tamas)

Hi,

This is still broken in build 19 (plex-desktop version 1.54.2) which causes segfault on launch on my Ubuntu 22.04 (running Gnome on Wayland) system.

DISABLE_WAYLAND must be set before the snap/command-chain/desktop-launch script executes, so setting it in Plex.sh is too late in the launch process.

I also note you’re running two different desktop-launch scripts - one that you are implicitly using from the gnome-3-38 extension (that is the one that supports disabling Wayland properly via the DISABLE_WAYLAND=1 variable) and the other that you’re adding separately (presumably via a part in your snapcraft.yaml). You should drop the latter one (in $SNAP/bin) in favour of relying on the one provided by the gnome extension. This will require dropping the bin/desktop-launch part of your command entry:

apps:
  plex-desktop:
    command: bin/desktop-launch $SNAP/Plex.sh
    plugs:
    - desktop
    - desktop-legacy
    - gsettings
    - opengl
    - wayland
    - x11
    - alsa
    - audio-playback
    - browser-support
    - graphics-core20
    - hardware-observe
    - network
    - network-bind
    - screen-inhibit-control
    command-chain:
    - snap/command-chain/snapcraft-runner
    - snap/command-chain/desktop-launch

(That is from meta/snap.yaml which is generated by snapcraft on build time, and isn’t exactly what you have in your snapcraft.yaml)

Edit: rewrite the post to be clearer.