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