I would like to launch a Qt application on start up. The application uses some of the features from weston/wayland desktop, so it should be launched on top of weston, right after weston is started. Normally, I work with SSH to connect to the target platform and launch the application using following commands:
systemctl stop weston
weston --tty=1
./QtApp
If I do not kill the weston and do not start it with a TTY, I get the following error:
Failed to create display
What I have tried to do is to set up a start up script and integrate it into the systemd:
[Unit]
Description = Onyx Service
After = weston.service
Type = forking
[Service]
ExecStart = /bin/bash /opt/onyx-start
[Install]
WantedBy = multi-user.target
However, as you can guess, this does not work. I need to manage to start an application on an existing weston instance that is not started with a TTY option.
Best Answer
Typically it's not about starting Weston on a specific tty, but about having the environment variables set which will route you to the proper instances of Wayland and Weston. These variables are such as
WAYLAND_DISPLAY
and evenDISPLAY
for applications that need XWayland.You can typically get the proper environment you need by sourcing a file such as
/etc/profile.d/weston.sh
(orwayland_env.sh
in some cases.) This is typically done for you when you log in to a shell, but systemd jobs do not launch a shell, so they don't get these variables set.Maybe try something like this in
onyx-start
:The service unit you have should work with that.
(If it still doesn't work, please list more details about your environment, such as the Linux distribution you're using, contents of
weston.service
, output ofsystemctl status weston.service
, contents ofweston.sh
orwayland_env.sh
and wether starting QtApp works through SSH without launching a new Weston, perhaps after sourcing the environment profile file, if for any reason those variables aren't being set on those connections.)