What is the correct way to build a GUI application that runs on Ubuntu Core?

Hello,

I built an electron app using electron-builder for my raspberry pi, but the problem is that it won’t run on Ubuntu Core. It throws this error:

Gtk-WARNING **: cannot open display

I’m guessing it’s because ubuntu core doesn’t ship with any graphical libraries installed.

Do I need to install some sort of a display server like this: https://snapcraft.io/mir-kiosk
…and then connect my electron app to that?

Or is this unnecessary and instead I need to follow these instructions: https://hackmd.io/0I09MG1FRKqO0ehIdLHpoQ#

The mir server electron app example seems a bit outdated – can’t figure out if that’s still the proper way to do things…

to get graphical apps running on core you need to use mir-kiosk

@Zane470 Hi, were you finally able to build your app for ubuntu core with electron-builder? I know that is necessary to use mir-kiosk for it, but only example I found is with snapcraft, not electron-builder


I noticed that it is possible to pass some additional parameters for snap build https://www.electron.build/configuration/snap , but it looks like it is not possible to send all mentioned in that electron-kiosk tutorial.

I realize this was a while ago but I’m trying to do the same thing, the tutorials point back to electron-builder but that doesn’t seem to have config options required to make this work. Did you every solve it?

From what I remember, there were some problems and develar (the developer of electron builder) got it working well enough to where I was able to build an electron app that ran on my desktop. I never got it to run on a PI since some additional configuration stuff needed to be done to get it to connect to mir-kiosk.

What I’d do is start with a working example, and then maybe you can modify the snap file to add the mir-kiosk stuff to get it to run on a PI.

This is using electron v8 and it looks like they must be getting it to build on a desktop with electron-builder. So I’d start with that and then try adding this stuff: https://ubuntu.com/tutorials/electron-kiosk#4-converting-the-electron-snap-into-a-kiosk-snap

Edit: Actually it looks like they updated this tutorial – https://ubuntu.com/tutorials/electron-kiosk#3-snapping-electron-apps Does that not work?

Thanks!
I was able to get it working using that updated tutorial, but just not using electron-builder. That yaml script has some config settings that don’t seem to map to the electron-builder config for snaps. Like setting up an ‘apps’ section. But building that via snapcraft works.