mirror of
https://github.com/open-webui/open-terminal.git
synced 2026-11-22 21:50:43 -05:00
refac
This commit is contained in:
1 parent
38ee642863
commit
40edf8e1e1
2 files changed
+9
-4
No files matched your search
@@ -334,7 +334,7 @@ class PortalDesktop(NativeDesktop):
|
||||
try:
|
||||
await asyncio.wait_for(self.first_frame.wait(), 15)
|
||||
except TimeoutError as exc:
|
||||
raise RuntimeError("PipeWire capture produced no screen frame within 15 seconds. Check that the shared desktop is unlocked and PipeWire is running." + self.capture_error()) from exc
|
||||
raise RuntimeError("PipeWire capture produced no screen frame within 15 seconds." + self.capture_error()) from exc
|
||||
self.grab()
|
||||
|
||||
async def read_stderr(self, process):
|
||||
|
||||
@@ -31,6 +31,7 @@ class WaylandDesktop(PortalDesktop):
|
||||
self.owner = None
|
||||
self.stream_path = None
|
||||
self.node_ready = asyncio.Event()
|
||||
self.services = {}
|
||||
self.width = self.screen_width = WIDTH
|
||||
self.height = self.screen_height = HEIGHT
|
||||
self.failure = "The virtual GNOME Wayland desktop has stopped. Reconnect to start a new session."
|
||||
@@ -67,6 +68,7 @@ class WaylandDesktop(PortalDesktop):
|
||||
start_new_session=True, stdout=output, stderr=output,
|
||||
)
|
||||
self.processes.append(process)
|
||||
self.services[name] = process
|
||||
return process
|
||||
|
||||
async def wait_socket(self, name, process):
|
||||
@@ -112,7 +114,8 @@ class WaylandDesktop(PortalDesktop):
|
||||
await self.wait_socket("bus", daemon)
|
||||
pipewire = await self.launch("pipewire", "pipewire")
|
||||
await self.wait_socket("pipewire-0", pipewire)
|
||||
await self.launch("wireplumber", "wireplumber")
|
||||
# Only link our screen stream; leave physical devices to the host.
|
||||
await self.launch("wireplumber", "wireplumber", "--profile=policy")
|
||||
compositor = await self.launch(
|
||||
"gnome", "gnome-shell", "--headless", "--wayland",
|
||||
f"--virtual-monitor={WIDTH}x{HEIGHT}", "--wayland-display=wayland-0",
|
||||
@@ -161,10 +164,12 @@ class WaylandDesktop(PortalDesktop):
|
||||
await self.start_capture(env=self.env)
|
||||
except Exception as exc:
|
||||
details = []
|
||||
for name in ("gnome", "pipewire", "dbus"):
|
||||
for name in ("wireplumber", "gnome", "pipewire", "dbus"):
|
||||
path = self.runtime / f"{name}.log"
|
||||
if path.exists():
|
||||
details.append(f"{name}: {path.read_text(errors='replace')[-1500:]}")
|
||||
process = self.services.get(name)
|
||||
status = f" (exit {process.returncode})" if process and process.returncode is not None else ""
|
||||
details.append(f"{name}{status}: {path.read_text(errors='replace')[-1500:]}")
|
||||
raise RuntimeError(f"Could not start virtual GNOME Wayland: {exc}\n" + "\n".join(details)) from exc
|
||||
|
||||
async def notify(self, member, signature, *body):
|
||||
|
||||
Reference in new issue
Block a user