Access to Wayland socket

My snap is missing access to the Wayland socket.

When I run a shell for the snap, I see that $XDG_RUNTIME_DIR is set to a directory that is not present.

$ echo $XDG_RUNTIME_DIR
/run/user/1000/snap.vainfo

I have these plugs and slots, which I hoped would be enough for wayland clients.

    plugs:
      - desktop
      - desktop-legacy
      - wayland
      - x11
    slots:
      - mpris

Am I missing something to make my snap able to connect to Wayland?

Thanks!

I would recommend using the gnome-3-38 (or gnome on core22) snapcraft extension. This would use the desktop-launch script automatically which handles some wayland setup.

Thank you, Ken.

Adding that extension indeed brings in the missing socket. Thanks!

It seems a bit heavy-handed to pull in gnome for a command-line utility, so I’ll take a look and see if I can get the specific fix integrated on itself.

It doesn’t actually pull it in, it just mounts the content inside your snap. Using this you should be able to make your snap much smaller.