How to auto-launch an electron app in snapcraft.yaml please?

Hello everybody…

I have a little problem. I’m trying to auto launch a snapped electron-app with snapcraft but I don’t know how to do that.

After installing the snap, my bootloader and my box-manager are auto launching. After that, I can launch my electron-app (helmetapp) with the next command : sudo electron-snap.helmetapp. All is working fine but now, I want to auto launch the electron-app (helmetapp) after the bootloader and the boxmanager launching. How can I do that ? The idea is that the entire snap has to auto-run after the booting of an embedded device.

That’s my snapcraft.yaml file :

name: electron-snap
version: ‘0.1’
summary: Test snapping Electron app
description: Test Snap

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

apps:
bootloader:
command: bin/node $SNAP/lib/node_modules/box2helmet-nodes/bootloader/main.js > $SNAP_DATA/bootloader-node.log 2>&1
daemon: simple
restart-condition: on-failure
plugs: [network]
boxmanager:
command: bin/node $SNAP/lib/node_modules/box2helmet-nodes/boxmanager/main.js > $SNAP_DATA/boxmanager-node.log 2>&1
daemon: simple
restart-condition: always
plugs: [network]
helmetapp:
command: desktop-launch $SNAP/wrapper2 > $SNAP_DATA/helmetapp-node.log 2>&1
plugs:
- network
- browser-support

parts:
nodes:
plugin: nodejs
electron-snap:
source: electron-snap
plugin: nodejs
electron-wrap:
source: electron-snap
plugin: copy
files:
wrapper: wrapper
after: [desktop-glib-only]
helmet-wrap:
source: helmetapp
plugin: copy
files:
wrapper2: wrapper2
/usr/share/alsa*: usr/share/alsa
after: [desktop-glib-only]
deps:
plugin: nil
stage-packages:
- libgconf-2-4
- libnss3
- libxss1
- fontconfig-config
- libasound2-data

desktop-integration:
plugin: nil
stage-packages:
- libappindicator1
- libdbusmenu-glib4
- libnotify4
- libunity9

Thank you in advance for your help.