Running snap in fullscreen mode

I have simple hello QT application. I have created the snap and I can run that snap in Kiosk mode. But I am not able to run the snap in fullscreen mode. Can you please help?

I followed the link but with no success.

I am running Ubuntu 18.04. Can you please suggest the steps I can follow?

Hi Amol, it is not clear from the OP what you done, what you want to achieve, nor what you’ve tried.

Is your intention to create a snap of your app that can run directly on your desktop? (And then fullscreen on the normal desktop?)

Or run your computer in a “kiosk” mode with the snap running on that kiosk?

If the latter, it may be all you need to do is reconfigure mir-kiosk to run as a daemon. (Note this will take over your screen and you’ll have to Ctrl-Alt-F2 back to your normal desktop.)

sudo snap set mir-kiosk daemon=true

Thank you for the reply Alan. Yes, my intention is to " create a snap of your app that can run directly on your desktop? (And then fullscreen on the normal desktop?) ".

I am getting an error " qt.qpa.plugin: Could not load the Qt platform plugin “xcb” in “” even though it was found. ".
Output of " snap logs -n 100 qello "

2020-12-23T05:20:56Z qello.daemon[18017]: + ln -sf /run/user/0/wayland-0 /run/user/0/snap.qello
2020-12-23T05:20:56Z qello.daemon[18017]: + ln -sf /run/user/0/wayland-0.lock /run/user/0/snap.qello
2020-12-23T05:20:56Z qello.daemon[18017]: + unset DISPLAY
2020-12-23T05:20:56Z qello.daemon[18017]: + exec /snap/qello/x1/bin/qello --fullscreen
2020-12-23T05:20:56Z qello.daemon[18017]: qt.qpa.xcb: could not connect to display

As mentioned in your previous posts, I referred the link for mir-kiosk-apps.

But could not resolve the issue. Following is my qello.yaml file.

name: qello
version: “2”
summary: Qt5 Application Example
description: A simple text editor
grade: stable
confinement: strict
base: core18

apps:
daemon:
#command-chain:
#- bin/wayland-launch
#command: bin/qello
#command: run-daemon wayland-launch $SNAP/bin/qello --fullscreen bin/qello
command: run-daemon wayland-launch $SNAP/bin/qello --fullscreen
#command: desktop-launch $SNAP/bin/qello --fullscreen
daemon: simple
restart-condition: always

qello:
environment:
# Use GTK3 cursor theme, icon theme and open/save file dialogs.
QT_QPA_PLATFORMTHEME: gtk3
QT_DEBUG_PLUGINS: 1
QT_QPA_PLATFORM: wayland
#DISABLE_WAYLAND: 1
# Qt Modules
LD_LIBRARY_PATH: $SNAP/Qt/5.14.2/gcc_64/lib
QT_PLUGIN_PATH: $SNAP/Qt/5.14.2/gcc_64/plugins
QML2_IMPORT_PATH: $QML2_IMPORT_PATH:$SNAP/Qt/5.14.2/gcc_64/qml
QT_QPA_PLATFORM_PLUGIN_PATH: $SNAP/Qt/5.14.2/gcc_64/plugins/platforms
# XDG Config
XDG_CONFIG_DIRS: $SNAP/etc/xdg:$SNAP/usr/xdg:$XDG_CONFIG_DIRS
XDG_DATA_DIRS: $SNAP/usr/share:$XDG_DATA_DIRS
# Font Config and themes
FONTCONFIG_PATH: $SNAP/etc/fonts/conf.d
FONTCONFIG_FILE: $SNAP/etc/fonts/fonts.conf
# Tell libGL where to find the drivers
LIBGL_DRIVERS_PATH: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/dri
command-chain:
- bin/wayland-launch
command: bin/qello
#plugs: [unity7, home, wayland, opengl, network, gsettings]

layout:
/etc/glvnd:
bind: $SNAP/etc/glvnd
/etc/fonts:
bind: $SNAP/etc/fonts
/etc/xdg:
bind: $SNAP/etc/xdg
/usr/share/X11/xkb:
bind: $SNAP/usr/share/X11/xkb
/usr/share/fonts:
bind: $SNAP/usr/share/fonts
/usr/share/glvnd:
bind: $SNAP/usr/share/glvnd

parts:
qtwayland:
plugin: nil
stage-packages:
- qtwayland5

mir-kiosk-snap-launch:
plugin: dump
source: https://github.com/MirServer/mir-kiosk-snap-launch.git
override-build: |
echo “snapctl set app=rssnews” >> $SNAPCRAFT_PART_BUILD/meta/hooks/install
echo “[ -e “$SNAP/apps/$(snapctl get app)” ] || snapctl set app=rssnews” >> $SNAPCRAFT_PART_BUILD/meta/hooks/post-refresh
$SNAPCRAFT_PART_BUILD/build-with-plugs.sh network opengl wayland
stage-packages:
- inotify-tools

qt5-gtk-platform:
plugin: nil
stage-packages:
- qt5-gtk-platformtheme

qello-app:
plugin: dump
source: .
organize:
qello: bin/

inotify-tools:
plugin: nil
stage-packages: [inotify-tools]
prime:
- usr/bin/inotifywait
- usr/lib

plugs:
network:
opengl:
wayland:
desktop:
x11:
gsettings:
gtk-3-themes:
interface: content
target: $SNAP/data-dir/themes
default-provider: gtk-common-themes
icon-themes:
interface: content
target: $SNAP/data-dir/icons
default-provider: gtk-common-themes
sound-themes:
interface: content
target: $SNAP/data-dir/sounds
default-provider: gtk-common-themes

OK, so you don’t want to create a kiosk, you want to create a desktop snap.

The “kiosk” tutorial deals with the things that are special to creating a kiosk (like running as a daemon on Ubuntu Core) that are not needed for a desktop snap and is probably not very useful for your usecase.

You are likely to be better off starting here:

Thanks Alan.
Sorry for confusion but fulscreen means in Kiosk mode. I mean, running QT5 application in Kiosk mode on desktop system with Ubuntu 18.04.

Sorry for misunderstand your issue. The post you first linked is about testing snaps on your normal desktop environment such as GNOME. That led me to think “desktop” meant “desktop environment”.

To run your snap in kiosk mode on a classic system, you first need to have mir-kiosk running as a “daemon”, which is not the default.

sudo snap install mir-kiosk
sudo snap set mir-kiosk daemon=true

This means mir-kiosk will take over the display from your desktop environment, but you can switch back and forth with Ctrl-Alt-F2/Ctrl-Alt-F4.

Hope that helps, and happy New Year!

Thanks Alan. Happy New year…
Yes, I can see the blank screen after “sudo snap set mir-kiosk daemon=true” command or after “sudo snap set mir-kiosk daemon=true & sudo snap restart mir-kiosk”.
I can login back using Alt+Ctrl+f2 combination. Then I make daemon as false with following commands.

$ sudo snap stop mir-kiosk
$ sudo snap set mir-kiosk daemon=false
$ sudo reboot

How can I run my application so that it runs in Kiosk mode instead of blank screen?

@Amol There should be no need for sudo reboot

You just run the daemon app. It looks like you’re using mir-kiosk-snap-launch, so it’s the same as with mir-kiosk:

 sudo snap set qello daemon=true

Ok. I ran application with following command.

$ sudo snap set qello daemon=true
$ sudo snap restart qello

But nothing happened. I took the logs with following command.

$ sudo snap logs -n 1000 qello
Following are the logs

2021-01-04T14:01:07Z systemd[1]: Stopping Service for snap application qello.daemon…
2021-01-04T14:01:07Z systemd[1]: Stopped Service for snap application qello.daemon.
2021-01-04T14:01:07Z systemd[1]: Started Service for snap application qello.daemon.
2021-01-04T14:01:07Z qello.daemon[5570]: + snapctl is-connected wayland
2021-01-04T14:01:07Z qello.daemon[5570]: + dirname /run/user/0/snap.qello
2021-01-04T14:01:07Z qello.daemon[5570]: + real_xdg_runtime_dir=/run/user/0
2021-01-04T14:01:07Z qello.daemon[5570]: + real_wayland=/run/user/0/wayland-0
2021-01-04T14:01:07Z qello.daemon[5570]: + [ ! -O /run/user/0/wayland-0 ]
2021-01-04T14:01:07Z qello.daemon[5570]: + [ ! -O /run/user/0 ]
2021-01-04T14:01:07Z qello.daemon[5570]: + echo waiting for host XDG_RUNTIME_DIR…
2021-01-04T14:01:07Z qello.daemon[5570]: waiting for host XDG_RUNTIME_DIR…
2021-01-04T14:01:07Z qello.daemon[5570]: + [ -O /run/user/0 ]
2021-01-04T14:01:07Z qello.daemon[5570]: + dirname /run/user/0
2021-01-04T14:01:07Z qello.daemon[5570]: + inotifywait --event create /run/user
2021-01-04T14:01:07Z qello.daemon[5570]: Setting up watches.
2021-01-04T14:01:07Z qello.daemon[5570]: Watches established.

Your snap is waiting for mir-kiosk to start.

Yes, so what should be my command sequence?

$ sudo snap install mir-kiosk
$ sudo snap set mir-kiosk daemon=true

then in virtual terminal (Ctrl+Alt+F2) , I need to give following commands?

$ sudo snap set qello daemon=true
$ sudo snap restart qello

Starting from where? Above you’ve had both snaps running as daemons, you just need both running as daemons at the same time.

Anyway, install both snaps (if necessary):

sudo snap install qello
sudo snap install mir-kiosk

Then enable daemon for both snaps:

sudo snap set qello daemon=true
sudo snap restart qello
sudo snap set mir-kiosk daemon=true