How to Show Native File Chooser Dialog

Greetings,

I am the owner of ruffle-unofficial. It currently is unusable due to some missing dependencies but I’ve solved it (did not reflect the update yet) with some reading on the internet.

I followed pre-built apps section of docs to build my snap and this is my snapcraft.yaml file:

name: ruffle-unofficial
# libssl does not exist in core
base: core18
version: '20210306nightly'
summary: "A Flash emulator"
description: |
  Ruffle is an Adobe Flash Player emulator.
architectures:
  - run-on: [amd64]
    build-on: [amd64]
grade: devel
icon: "icon.png"
license: "MIT"
title: "Ruffle (Unofficial)"

grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots

# ngl, i only have a brief idea as to what these do
apps:
  ruffle:
    plugs:
      - alsa
      - audio-playback
      - desktop
      - desktop-legacy
      - opengl
      - pulseaudio
      - removable-media
      - system-files
      - x11

parts:
  ruffle:
    plugin: dump
    source: https://github.com/ruffle-rs/ruffle/releases/download/nightly-2021-03-06/ruffle_nightly_2021_03_06_linux.tar.gz
    stage-packages:
        - libxcb1
        - libxcb-render0
        - libxcb-shape0
        - libasound2
        - libxcb-xfixes0
        - dialog
        - libx11-6
        - libxcursor1
        - libssl1.1
        - libcrypto++6

apps:
  ruffle:
    command: ruffle

And I’ve also written some bash script to try the package, the contents of which are:

#!/bin/bash

snapcraft try --use-lxd
snap try prime --devmode
ruffle-unofficial.ruffle

Ruffle, in case you didn’t know or too lazy, is a Flash emulator. It releases a fat binary that you can emulate the swf files with. When you launch ruffle binary, it fires up a native file chooser dialog. Then you select the file to emulate.

This is not the case with snap though. When I try it, ruffle greets me with something like:

missing software! (we will try basic console input)

 ___________
/           \ 
| tiny file |
|  dialogs  |
\_____  ____/
      \|
tiny file dialogs on UNIX needs:
   applescript or kdialog or yad or Xdialog
or zenity (or matedialog or shellementary or qarma)
or python (2 or 3) + tkinter + python-dbus (optional)
or dialog (opens console if needed)
or xterm + bash (opens console for basic input)
or existing console for basic input

press enter to continue 

Actually the message is self explanatory. It requires one of the options to run a native file chooser dialog. The problem is, even if I add, for instance, yad to stage-packages array, it still shows the same thing. I get it is because the snap application runs on a confined environment.

So, the question is, how do I get it to show native file chooser dialog.

Thanks in advance.

PS: I am kinda new to snaps.

Don’t forget you’ll need the dependencies for yad. These are easiest to provide by using the gnome-3-28 extension:

apps:
  ruffle:
    command: ruffle
    extensions: [gnome-3-28]

With the above and yad added to stage-packages I can successfully build and start ruffle to get the dialog popup.

In my case the process exits with 7228. Let me investigate.