Open History to see the last commit
1import * as Effect from "effect/Effect";
2
3import { receiveProviderAuthCallback, cancelProviderAuthCallback } from "./methods/providerAuth.ts";
4import * as DesktopIpc from "./DesktopIpc.ts";
5import { installNotificationBadge } from "./methods/notificationBadge.ts";
6import { getClientSettings, setClientSettings } from "./methods/clientSettings.ts";
7import { getConnectionCatalog, setConnectionCatalog } from "./methods/connectionCatalog.ts";
8import {
9 getHostEnvironmentId,
10 getLocalEnvironmentEnabled,
11 setLocalEnvironmentEnabled,
12} from "./methods/localEnvironment.ts";
13import {
14 getAdvertisedEndpoints,
15 getServerExposureState,
16 setServerExposureMode,
17 setTailscaleServeEnabled,
18} from "./methods/serverExposure.ts";
19import {
20 bootstrapSshBearerSession,
21 disconnectSshEnvironment,
22 discoverSshHosts,
23 ensureSshEnvironment,
24 fetchSshEnvironmentDescriptor,
25 fetchSshSessionState,
26 resolveSshHost,
27 resolveSshPasswordPrompt,
28} from "./methods/sshEnvironment.ts";
29import {
30 checkForUpdate,
31 downloadUpdate,
32 getUpdateState,
33 installUpdate,
34 setUpdateChannel,
35} from "./methods/updates.ts";
36import {
37 getAppBranding,
38 getLocalEnvironmentBootstraps,
39 getLocalEnvironmentBearerToken,
40 installRelayTelemetryEnabled,
41 getSystemLocale,
42 getPreferredSystemLanguages,
43 getWindowFullscreenState,
44 openExternal,
45 readMedia,
46 openSystemSettings,
47 checkSystemPermission,
48 pasteAsText,
49 probeRemoteEditors,
50 revealWindow,
51 pickFolder,
52 pickProjectFavicon,
53 pickThemeFiles,
54 setTheme,
55 showContextMenu,
56} from "./methods/window.ts";
57import {
58 acknowledgeSnapShot,
59 checkSnapShotShortcut,
60 dismissSnapShotAnimation,
61 getSnapShotState,
62 setupSnapShot,
63 previewSnapShotConfig,
64 applySnapShotConfig,
65 listPendingSnapShots,
66 readSnapShot,
67 requestSnapShotPermissions,
68 setSnapShotAnimationDestination,
69 setSnapShotShortcutSuppressed,
70} from "./methods/snapShot.ts";
71import * as PreviewIpc from "./methods/preview.ts";
72import * as AppActivationIpc from "./methods/appActivation.ts";
73import * as WebLinksIpc from "./methods/webLinks.ts";
74import {
75 completeLegacyLocalStorage,
76 takeLegacyLocalStorage,
77} from "./methods/legacyLocalStorage.ts";
78import { getWslState, setWslBackendEnabled, setWslDistro, setWslOnly } from "./methods/wsl.ts";
79import {
80 getCliCommandState,
81 installCliCommand,
82 uninstallCliCommand,
83 addCliCommandToPath,
84} from "./methods/cliCommand.ts";
85
86export const installDesktopIpcHandlers = Effect.fn("desktop.ipc.installHandlers")(function* () {
87 const ipc = yield* DesktopIpc.DesktopIpc;
88 yield* installNotificationBadge();
89 yield* PreviewIpc.installPreviewEventForwarding();
90
91 yield* ipc.handle(AppActivationIpc.setReady);
92 yield* ipc.handle(AppActivationIpc.complete);
93 yield* ipc.handle(WebLinksIpc.setReady);
94
95 yield* ipc.handleSync(takeLegacyLocalStorage);
96 yield* ipc.handle(completeLegacyLocalStorage);
97 yield* ipc.handleSync(getAppBranding);
98 yield* installRelayTelemetryEnabled();
99 yield* ipc.handleSync(getSystemLocale);
100 yield* ipc.handleSync(getPreferredSystemLanguages);
101 yield* ipc.handleSync(getWindowFullscreenState);
102 yield* ipc.handleSync(getLocalEnvironmentBootstraps);
103 yield* ipc.handleSync(getLocalEnvironmentEnabled);
104 yield* ipc.handle(setLocalEnvironmentEnabled);
105 yield* ipc.handle(getHostEnvironmentId);
106 yield* ipc.handle(getLocalEnvironmentBearerToken);
107
108 yield* ipc.handle(getClientSettings);
109 yield* ipc.handle(setClientSettings);
110 yield* ipc.handle(getConnectionCatalog);
111 yield* ipc.handle(getSnapShotState);
112 yield* ipc.handle(setupSnapShot);
113 yield* ipc.handle(previewSnapShotConfig);
114 yield* ipc.handle(applySnapShotConfig);
115 yield* ipc.handle(requestSnapShotPermissions);
116 yield* ipc.handle(checkSnapShotShortcut);
117 yield* ipc.handle(setSnapShotShortcutSuppressed);
118 yield* ipc.handle(listPendingSnapShots);
119 yield* ipc.handle(readSnapShot);
120 yield* ipc.handle(setSnapShotAnimationDestination);
121 yield* ipc.handle(dismissSnapShotAnimation);
122 yield* ipc.handle(acknowledgeSnapShot);
123 yield* ipc.handle(setConnectionCatalog);
124
125 yield* ipc.handle(discoverSshHosts);
126 yield* ipc.handle(resolveSshHost);
127 yield* ipc.handle(ensureSshEnvironment);
128 yield* ipc.handle(disconnectSshEnvironment);
129 yield* ipc.handle(fetchSshEnvironmentDescriptor);
130 yield* ipc.handle(bootstrapSshBearerSession);
131 yield* ipc.handle(fetchSshSessionState);
132 yield* ipc.handle(resolveSshPasswordPrompt);
133
134 yield* ipc.handle(getServerExposureState);
135 yield* ipc.handle(setServerExposureMode);
136 yield* ipc.handle(setTailscaleServeEnabled);
137 yield* ipc.handle(getAdvertisedEndpoints);
138
139 yield* ipc.handle(getWslState);
140 yield* ipc.handle(setWslBackendEnabled);
141 yield* ipc.handle(setWslDistro);
142 yield* ipc.handle(setWslOnly);
143
144 yield* ipc.handle(pickFolder);
145 yield* ipc.handle(pickProjectFavicon);
146 yield* ipc.handle(pickThemeFiles);
147 yield* ipc.handle(setTheme);
148 yield* ipc.handle(showContextMenu);
149 yield* ipc.handle(openExternal);
150 yield* ipc.handle(readMedia);
151 yield* ipc.handle(receiveProviderAuthCallback);
152 yield* ipc.handle(cancelProviderAuthCallback);
153 yield* ipc.handle(openSystemSettings);
154 yield* ipc.handle(checkSystemPermission);
155 yield* ipc.handle(pasteAsText);
156 yield* ipc.handle(revealWindow);
157 yield* ipc.handle(probeRemoteEditors);
158 yield* ipc.handle(getUpdateState);
159 yield* ipc.handle(setUpdateChannel);
160 yield* ipc.handle(downloadUpdate);
161 yield* ipc.handle(installUpdate);
162 yield* ipc.handle(checkForUpdate);
163 yield* ipc.handle(getCliCommandState);
164 yield* ipc.handle(installCliCommand);
165 yield* ipc.handle(uninstallCliCommand);
166 yield* ipc.handle(addCliCommandToPath);
167 for (const previewMethod of PreviewIpc.methods) {
168 // Explicit types preserve the error/service union of these heterogeneous preview methods.
169 yield* ipc.handle<
170 Effect.Error<ReturnType<(typeof PreviewIpc.methods)[number]["handler"]>>,
171 Effect.Services<ReturnType<(typeof PreviewIpc.methods)[number]["handler"]>>
172 >(previewMethod);
173 }
174 yield* ipc.handle(PreviewIpc.listBrowserImportSources);
175 yield* ipc.handle(PreviewIpc.importBrowserCookies);
176});