I would like to arrange focus of two applications in a wayland-weston desktop system. Two applications are:
I would like to keep App#1 always on top and App#2 always on bottom, even if I kill and respawn either of them. I also would like to do this while both of them are fullscreen apps.
I have investigated and found few ways to achieve this:
Using wmctrl
to arrange windows in a desktop system: I've tried this. However, I get Cannot open display.
. I found out later that wmctrl
does not work with Weston/XWayland, works only with X11. So, I don't think this is an option any longer.
Make the App#1 (Qt/QML) always on top by default: What I've tried in order to solve this is I've added the following in my main.qml:
ApplicationWindow {
visible: true
visibility: "FullScreen"
width: 1920
height: 720
flags: Qt.WindowStaysOnTopHint|Qt.FramelessWindowHint
MainScreen{
anchors.fill: parent
}
}
Make the App#2 (Wayland Client API/OpenGL) always on bottom by default. To be honest, I am not familiar with Wayland Client API that much, but I could explore it with some guidance, if something like this is even possible.
Right now, My focus is making Qt application always on top. It works in my PC, but it does not work in target platform. My PC is Ubuntu 16.04, with Xorg. Target platform has weston compositor with xwayland backend. I don't know why it does not work in the target. It maybe the desktop system. Any guidance and ideas are appreciated. Thanks
EDIT: main.cpp
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;
return app.exec();
EDIT main.qml
import QtQuick 2.0
import QtQuick.Controls 2.0
import QtQuick.Window 2.2
import "app/main"
ApplicationWindow {
visible: true
visibility: "FullScreen"
maximumWidth: 1920
maximumHeight: 720
minimumWidth: 1920
minimumHeight: 720
width: 1920
height: 720
title: qsTr("App")
flags: Qt.FramelessWindowHint|Qt.WindowStaysOnTopHint
MainScreen{
anchors.fill: parent
}
}
EDIT: Qt Version Qt 5.10.1 on PC, Qt 5.8.0 on target platform
I have opened an issue on Qt Bugs and learned from a Qt employee that this is not possible due to the restrictions from Weston compositor. So, either I will create my own compositor or use a different one.