I created an example Qt Wayland compositor and the QML code goes like this:
import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.0
import QtWayland.Compositor 1.0
WaylandCompositor{
id:comp
WaylandOutput{
compositor:comp
sizeFollowsWindow:true
window:Window{
visible:true
width:700
height:700
Repeater{
model:shellSurfaces
ShellSurfaceItem{
shellSurface:modelData
onSurfaceDestroyed:shellSurfaces.remove(index)
}
}
}
}
ListModel{id:shellSurfaces}
WlShell{
onWlShellSurfaceCreated:{
shellSurfaces.append({shellSurface:shellSurface});
}
}
}
I know I can open a wiggly window using --platform wayland
after the command. How can I open other software windows in the Wayland compositor(for example Firefox)?
(I don't know the basics of display servers and Wayland compositors. I think the compositor that I've created is just like a window manager and the apps that I open in it should just open in the compositor as it opens in a window manager).
When your compositor loads, it creates a socket on your computer. On my machine, it is located in /run/user/1000
. It should be named something like 0-wayland
.
In order to launch an app you need to pass the wayland display to it via a environment variable.
Example:
Launch firefox : WAYLAND_DISPLAY=wayland-0 XDG_RUNTIME_DIR=/run/user/1000 XDG_SESSION_TYPE="wayland" firefox
Launch kcalc(KDE's calculator): WAYLAND_DISPLAY=wayland-0 XDG_RUNTIME_DIR=/run/user/1000 XDG_SESSION_TYPE="wayland" kcalc
I think you get the idea.