Files
clearpilot/system/clearpilot/notes_wayland.txt
Your Name 09bdc79e69 wip
2024-04-27 00:43:39 -05:00

47 lines
3.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
From the information you've provided, particularly the configuration in the systemd service file for Weston and related directories, we can deduce several important environmental setup aspects for running applications using the Wayland display server (Weston) on your device.
Key Takeaways
Weston Configuration and Runtime Directory:
Weston is run with specific configurations specified in /usr/comma/weston.ini.
The XDG_RUNTIME_DIR environment variable is set to /var/tmp/weston. This is crucial because Wayland clients locate the Wayland server (Weston in this case) through the WAYLAND_DISPLAY environment variable, which typically points to a socket file within XDG_RUNTIME_DIR.
Service Setup:
Pre-execution steps in the Weston service ensure that the runtime directory exists and has the correct permissions. This directory is used by Weston to store its runtime data, including the socket file (wayland-0), which clients use to communicate with Weston.
Execution Parameters:
Weston is started with the --config flag pointing to a custom configuration file and on a specific TTY. This setup is essential for correctly initializing the display server on your device.
Making Your PyQt Application Work
Given the above setup, you should ensure your PyQt application is configured to correctly interact with this environment. Here's what you need to do:
Set the XDG_RUNTIME_DIR Environment Variable: This should match the configuration of the Weston service to ensure that your application can find the Wayland display server.
Direct PyQt to use the Wayland Platform:
Explicitly set the platform to Wayland in your PyQt application.
Ensure the WAYLAND_DISPLAY environment variable points to the correct socket file, usually wayland-0 inside your runtime directory.
Heres how you can modify your Python script to accommodate these settings:
python
Copy code
import os
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QHBoxLayout, QScrollBar
from PyQt5.QtCore import Qt
# Set environment variables to match the Weston configuration
os.environ["XDG_RUNTIME_DIR"] = "/var/tmp/weston"
os.environ["WAYLAND_DISPLAY"] = "wayland-0" # Typically the socket is named wayland-0
os.environ["QT_QPA_PLATFORM"] = "wayland"
app = QApplication(sys.argv)
window = QWidget()
window.setWindowTitle("PyQt on Wayland")
layout = QHBoxLayout(window)
scroll = QScrollBar(Qt.Vertical)
layout.addWidget(scroll)
window.setLayout(layout)
window.show()
sys.exit(app.exec_())
Summary
By aligning your PyQt environment with the established Weston configuration:
You replicate the environmental setup that native applications use, ensuring compatibility.
You directly address the issue of the PyQt application failing to find or connect to the Weston display server, which is indicated by errors related to the xcb platform plugin.
This setup should resolve the issues you've been facing with launching your PyQt application on the device. Ensure that Weston is actively running when you attempt to start your application, as it must be running to accept connections from Wayland clients.