@hasna/machines 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js
CHANGED
|
@@ -18214,6 +18214,22 @@ function hasCommand3(binary) {
|
|
|
18214
18214
|
const result = Bun.spawnSync(["bash", "-lc", `command -v ${binary} >/dev/null 2>&1`], { stdout: "ignore", stderr: "ignore", env: process.env });
|
|
18215
18215
|
return result.exitCode === 0;
|
|
18216
18216
|
}
|
|
18217
|
+
function hasDisplayServer() {
|
|
18218
|
+
const display = process.env["DISPLAY"] || "";
|
|
18219
|
+
const wayland = process.env["WAYLAND_DISPLAY"] || "";
|
|
18220
|
+
if (display || wayland)
|
|
18221
|
+
return true;
|
|
18222
|
+
try {
|
|
18223
|
+
const result = Bun.spawnSync(["wl-paste", "--no-newline"], { stdout: "pipe", stderr: "pipe", env: process.env, timeout: 2000 });
|
|
18224
|
+
if (result.exitCode === 0) {
|
|
18225
|
+
const output = result.stdout.toString("utf8");
|
|
18226
|
+
if (/\x1b\]52;/.test(output))
|
|
18227
|
+
return false;
|
|
18228
|
+
return output.length > 0;
|
|
18229
|
+
}
|
|
18230
|
+
} catch {}
|
|
18231
|
+
return false;
|
|
18232
|
+
}
|
|
18217
18233
|
function computeHash2(content) {
|
|
18218
18234
|
return createHash3("sha256").update(content).digest("hex").slice(0, 16);
|
|
18219
18235
|
}
|
|
@@ -18263,7 +18279,13 @@ function startClipboardDaemon(port) {
|
|
|
18263
18279
|
let lastHash = "";
|
|
18264
18280
|
const secret = loadSharedSecret2();
|
|
18265
18281
|
const machineId = process.env["HASNA_MACHINES_MACHINE_ID"] || "unknown";
|
|
18282
|
+
const hasDisplay = hasDisplayServer();
|
|
18283
|
+
if (!hasDisplay) {
|
|
18284
|
+
console.log("clipboard daemon running in receive-only mode (no display server)");
|
|
18285
|
+
}
|
|
18266
18286
|
setInterval(async () => {
|
|
18287
|
+
if (!hasDisplay)
|
|
18288
|
+
return;
|
|
18267
18289
|
const content = readLocalClipboardSync2();
|
|
18268
18290
|
if (!content)
|
|
18269
18291
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard-daemon.d.ts","sourceRoot":"","sources":["../../src/commands/clipboard-daemon.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"clipboard-daemon.d.ts","sourceRoot":"","sources":["../../src/commands/clipboard-daemon.ts"],"names":[],"mappings":"AA4GA,wBAAgB,mBAAmB,IAAI;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAO9E;AAED,wBAAgB,oBAAoB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CA6DxD"}
|