Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): capture browser tabs while macOS is locked #41212

OpenJayHopsHQ(GitHub profile, opens in a new tab)wants to merge 3 commits intomain fromrefs/pull/41212/headopened View on GitHub

Showing 6 changed files with 68 additions and 9 deletions (loading 4).

x
0 of 6 viewed, 6 left
59 additions and 9 deletionsapps/desktop/src/preview/DesktopBrowserHost.test.tsModified
View file
@@ -1,6 +1,7 @@
// @effect-diagnostics nodeBuiltinImport:off - Stands in for an Electron debugger.
import { describe, expect, it, vi } from "@effect/vitest";
import { DesktopBrowserEvent } from "@t3tools/contracts";
+import * as HostProcess from "@t3tools/shared/HostProcess";
import * as Effect from "effect/Effect";
import * as Fiber from "effect/Fiber";
import * as Queue from "effect/Queue";
@@ -32,8 +33,13 @@
);
const key = { threadId: "thread-1", tabId: "tab-1" };
​
+// The lifecycle fixture models CDP replies; native routing has its own platform cases below.
+const makeCdpHost = DesktopBrowserHost.make.pipe(
+ Effect.provideService(HostProcess.Platform, "linux"),
+);
+​
/** A host whose client already draws `key` at full detail, so its screenshots go out at once. */
-const makeDrawnHost = Effect.tap(DesktopBrowserHost.make, (host) =>
+const makeDrawnHost = Effect.tap(makeCdpHost, (host) =>
Effect.sync(() => host.setCaptureDrawn(key, true)),
);
/** Sends a page command whose id the fake debugger records as it receives it. */
@@ -203,6 +209,50 @@
});
​
describe("DesktopBrowserHost", () => {
+ it.effect.each(["darwin", "linux"] as const)(
+ "uses native viewport capture only on macOS (%s)",