Start/stop snaps from different snap


#1

Environment:
Ubuntu Core 18.04 on an Intel NUC connected to a Touchscreen with webcam.

Scope:
Run a webpage in Kiosk mode and activate screen only if someone is around.

Setup:
mir-kiosk
chromium-mir-kiosk
motion-ogra

In the configuration options of “motion-ogra” (on_event_start/on_event_end) one can choose to call a script if motion starts or ends.

In this script I’d like to turn on/off the screen so that it only is activated if someone is around.
So, one chance would be to start or stop the snap “chromium-mir-kiosk” to get the screen enlightened or blank.

Another possibility would be to use some sort of command to turn the HDMI output off and on again.

BUT:
How can I access resources out of one snaps scope?

Any help would be welcome.

Thanks in advance!

Regards,
Daniel


#2

to control snaps you would need to add the snapd-control interface to the snap you desire to manage other snaps with, that would give you access to the snapd API allowing snap management (including start/stop etc) …

BUT ! note that this interface is exclusively reserved for brand store usage, a snap with this interface enabled in snapcraft.yaml will be blocked from entering the pubic store …

alternatively perhaps the display-control interface might be of help (not sure it actually allows you to turn off/on the display completely, i never used it), i’d try to tinker with that one …