The best way to control Claude Code, Codex and more from any computer or phone
feat(desktop): drag file pills into Explorer on Windows (#38096)
Co-authored-by: Cursor <cursoragent@cursor.com>
Yash Singh committed
Nov 17, 2026 at 05:57 UTC
9830b857dea6aa402af0bcbaa77601e2284300d5
3 files changed
+12
-7
apps/desktop/src/ipc/methods/fileDrag.test.ts
+7
-3
@@ -15,7 +15,7 @@ import * as DesktopEnvironment from "../../app/DesktopEnvironment.ts";
15
import * as ElectronWindow from "../../electron/ElectronWindow.ts";
16
import { startFileDrag } from "./fileDrag.ts";
17
18
-it.effect("only drags existing absolute paths from the Mac host environment and app window", () =>
18
+it.effect("only drags existing absolute paths from the host environment and app window", () =>
19
Effect.gen(function* () {
20
startDrag.mockClear();
21
getFileIcon.mockClear();
@@ -43,9 +43,13 @@ it.effect("only drags existing absolute paths from the Mac host environment and
43
assert.isFalse(yield* run("host", filePath, "darwin", 2));
44
assert.strictEqual(startDrag.mock.calls.length, 0);
45
assert.isTrue(yield* run("host", filePath));
46
- assert.deepEqual(startDrag.mock.calls, [[{ file: filePath, icon: "file-icon" }]]);
46
+ assert.isTrue(yield* run("host", filePath, "win32"));
47
+ assert.deepEqual(startDrag.mock.calls, [
48
+ [{ file: filePath, icon: "file-icon" }],
49
+ [{ file: filePath, icon: "file-icon" }],
50
+ ]);
51
yield* fs.remove(path.join(stateDir, "environment-id"));
52
assert.isFalse(yield* run("host", filePath));
49
- assert.strictEqual(startDrag.mock.calls.length, 1);
53
+ assert.strictEqual(startDrag.mock.calls.length, 2);
54
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
55
);
apps/desktop/src/ipc/methods/fileDrag.ts
+2
-1
@@ -16,7 +16,8 @@ export const startFileDrag = makeIpcMethod({
16
result: Schema.Boolean,
17
handler: Effect.fn("desktop.ipc.fileDrag.start")(function* (input, event) {
18
const environment = yield* DesktopEnvironment.DesktopEnvironment;
19
- if (environment.platform !== "darwin" || !environment.path.isAbsolute(input.path)) return false;
19
+ if (environment.platform !== "darwin" && environment.platform !== "win32") return false;
20
+ if (!environment.path.isAbsolute(input.path)) return false;
21
const hostEnvironmentId = yield* getHostEnvironmentId.handler(undefined);
22
if (hostEnvironmentId === null || input.environmentId !== hostEnvironmentId) return false;
23
const window = yield* (yield* ElectronWindow.ElectronWindow).main;
apps/web/src/useNativeFileDrag.ts
+3
-3
@@ -1,5 +1,5 @@
1
import { splitFilePathPosition } from "@t3tools/shared/fileLinks";
2
-import { isMacPlatform } from "./lib/utils";
2
+import { isMacPlatform, isWindowsPlatform } from "./lib/utils";
3
import { useAtomValue } from "@effect/atom-react";
4
import { AuthOrchestrationOperateScope, type EnvironmentId } from "@t3tools/contracts";
5
import type { DragEvent } from "react";
@@ -16,7 +16,7 @@ export function useNativeFileDrag(
16
const canOperate = useEnvironmentScope(environmentId ?? null, AuthOrchestrationOperateScope);
17
const enabled =
18
typeof window.desktopBridge?.startFileDrag === "function" &&
19
- isMacPlatform(navigator.platform) &&
19
+ (isMacPlatform(navigator.platform) || isWindowsPlatform(navigator.platform)) &&
20
environmentId != null &&
21
environmentId === hostEnvironmentId &&
22
canOperate;
@@ -33,7 +33,7 @@ export function useNativeFileDrag(
33
const { path } = splitFilePathPosition(await resolvePath());
34
if (released) return;
35
const started = await window.desktopBridge?.startFileDrag({ environmentId, path });
36
- if (!started) throw new Error("The file is unavailable on this Mac.");
36
+ if (!started) throw new Error("The file is unavailable on this computer.");
37
})().catch((error: unknown) => {
38
if (released) return;
39
toastManager.add({