How to automatically run desktop app in Weston?

Hi! I want to automatically start a desktop app in Weston after boot. I’ve read the Toradex article and tried both the systemctl and graphical approaches, but without success.

This is the service file I’ve used:

[Unit]
Description=Startup script
After=weston.service

[Service]
ExecStart=/usr/bin/python3 /home/root/magusdl/main.py

[Install]
WantedBy=multi-user.target

I’ve also tried placing a .desktop file in /etc/xdg/autostart/. This is the .desktop file I’ve used:

[Desktop Entry]
Type=Application
Version=1.0
Name=My App
Exec=/usr/bin/python3 /home/root/magusdl/main.py
Icon=/usr/share/icons/icon.png

I confirm that when I execute the line /usr/bin/python3 /home/root/magusdl/main.py from the terminal, it opens the app.

Does anybody know how to make the app launch automatically?

Hello @CristianM ,

It has recently come to our view that the Weston cannot start the Desktop python. And we have come up a workaround like in this example below:

Your app.service may look like this:

    [Unit]
    Description=Start a wayland application
    After=weston@root.service
    Requires=weston@root.service
    [Service]
    Restart=on-failure
    Type=forking
    Environment="DISPLAY=:0.0"
    ExecStart=/usr/bin/wayland-app-launch.sh
    RestartSec=1
    [Install]
    WantedBy=multi-user.target

And your wayland.sh can look something like this:

#!/bin/sh
if test -z "$XDG_RUNTIME_DIR"; then
    export XDG_RUNTIME_DIR=/run/user/`id -u`
    if ! test -d "$XDG_RUNTIME_DIR"; then
        mkdir --parents $XDG_RUNTIME_DIR
        chmod 0700 $XDG_RUNTIME_DIR
    fi
fi
# wait for weston
while [ ! -e  $XDG_RUNTIME_DIR/wayland-0 ] ; do sleep 0.1; done
sleep 1
/path/to/the/application &

We are working on updating the article as well. Meanwhile, I hope this helps!

Best Regards,
Janani

Thank you. Unfortunately, as you know from this post, I was forced to move to X11 because the Weston virtual keyboard is not compatible with the Gtk framework that I am using for the Python app. Specifically, it is not displayed when accessing a text input box.

1 Like

Hello @CristianM ,

Ah, I see! So this is not relevant to you anymore.
But, still, this is the solution when other customers need! Thank you.

Best regards,
Janani.

I’ve tried your solution and it works. If only the weston-keyboard worked…

Thanks. I see that’s been discussed in a separate thread. One of us will pick it up there.

Best Regards,
Janani.

hello, @CristianM can you teach me to show the weston virtual keyboard… i use pyqt5 and too qt5

thanks.

[image]

Hi. You can see the answers above. There may be some changes due to the fact that you are using qt, but I am not sure.

Dear @AlanM,

Welcome to the Toradex Community. Could you please open a new post about it so that other users could also profit from the possible outcomes? In the meantime you could have a look on topics like this: QtVirtualKeyboard not shown - #7 by DarKMooN

Best regards,
Guilherme