feat(entry): implement def validate_wayland_environment
This commit is contained in:
parent
84ec0e05ba
commit
83e3cdef33
1 changed files with 17 additions and 0 deletions
|
|
@ -97,3 +97,20 @@ def configure_qt_backend(backend):
|
||||||
# settings when available (for example dark/light mode).
|
# settings when available (for example dark/light mode).
|
||||||
if os.path.exists("/.dockerenv"):
|
if os.path.exists("/.dockerenv"):
|
||||||
os.environ.setdefault("QT_QPA_PLATFORMTHEME", "gtk3")
|
os.environ.setdefault("QT_QPA_PLATFORMTHEME", "gtk3")
|
||||||
|
|
||||||
|
|
||||||
|
# validate_wayland_environment: function definition for ScanSlicer behavior.
|
||||||
|
def validate_wayland_environment():
|
||||||
|
runtime_dir = os.environ.get("XDG_RUNTIME_DIR", "").strip()
|
||||||
|
display_name = os.environ.get("WAYLAND_DISPLAY", "").strip()
|
||||||
|
if not runtime_dir or not display_name:
|
||||||
|
raise RuntimeError(
|
||||||
|
"Missing Wayland runtime environment. "
|
||||||
|
"Set XDG_RUNTIME_DIR and WAYLAND_DISPLAY."
|
||||||
|
)
|
||||||
|
|
||||||
|
socket_path = os.path.join(runtime_dir, display_name)
|
||||||
|
if not os.path.exists(socket_path):
|
||||||
|
raise RuntimeError(
|
||||||
|
f"Wayland socket not found: {socket_path}"
|
||||||
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue