({
platform = process.platform,
run = spawnSync,
osRelease = systemOsRelease(),
} = {})
| 41 | |
| 42 | /** Diagnose missing Linux-only linker/runtime pieces; return null when ready. */ |
| 43 | export function desktopRuntimeProblem({ |
| 44 | platform = process.platform, |
| 45 | run = spawnSync, |
| 46 | osRelease = systemOsRelease(), |
| 47 | } = {}) { |
| 48 | if (platform !== "linux") return null; |
| 49 | |
| 50 | const missing = []; |
| 51 | const xdo = run("cc", ["-print-file-name=libxdo.so"], { encoding: "utf8" }); |
| 52 | if (xdo.status !== 0 || !xdo.stdout?.trim() || xdo.stdout.trim() === "libxdo.so") { |
| 53 | missing.push("libxdo (required by Enigo at link time)"); |
| 54 | } |
| 55 | |
| 56 | const audioSink = run("gst-inspect-1.0", ["autoaudiosink"], { stdio: "ignore" }); |
| 57 | if (audioSink.status !== 0) { |
| 58 | missing.push("GStreamer autoaudiosink (required by WebKit audio)"); |
| 59 | } |
| 60 | if (missing.length === 0) return null; |
| 61 | |
| 62 | return [ |
| 63 | "", |
| 64 | `❌ Linux desktop prerequisite${missing.length === 1 ? " is" : "s are"} missing:`, |
| 65 | ...missing.map((item) => ` • ${item}`), |
| 66 | "", |
| 67 | " Without autoaudiosink, WebKitGTK can abort its renderer when the UI", |
| 68 | " creates an audio element, leaving a blank window.", |
| 69 | "", |
| 70 | " Install the required packages:", |
| 71 | ` ${linuxDesktopDependencyCommand(osRelease)}`, |
| 72 | "", |
| 73 | " Then rerun: bun desktop", |
| 74 | "", |
| 75 | ].join("\n"); |
| 76 | } |
| 77 | |
| 78 | /** Print an actionable diagnosis and report whether desktop launch may continue. */ |
| 79 | export function desktopRuntimeReady(options) { |
no test coverage detected