@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 33 lines 1.38 KB
Raw
1 import { ClientSettingsSchema } from "@t3tools/contracts";
2 import * as Effect from "effect/Effect";
3 import * as Option from "effect/Option";
4 import * as Schema from "effect/Schema";
5
6 import { applyLanguage } from "../../i18n/messages.ts";
7 import * as DesktopClientSettings from "../../settings/DesktopClientSettings.ts";
8 import * as DesktopSnapShot from "../../snapShot/DesktopSnapShot.ts";
9 import * as IpcChannels from "../channels.ts";
10 import * as DesktopIpc from "../DesktopIpc.ts";
11
12 export const getClientSettings = DesktopIpc.makeIpcMethod({
13 channel: IpcChannels.GET_CLIENT_SETTINGS_CHANNEL,
14 payload: Schema.Void,
15 result: Schema.NullOr(ClientSettingsSchema),
16 handler: Effect.fn("desktop.ipc.clientSettings.get")(function* () {
17 const clientSettings = yield* DesktopClientSettings.DesktopClientSettings;
18 return Option.getOrNull(yield* clientSettings.get);
19 }),
20 });
21
22 export const setClientSettings = DesktopIpc.makeIpcMethod({
23 channel: IpcChannels.SET_CLIENT_SETTINGS_CHANNEL,
24 payload: ClientSettingsSchema,
25 result: Schema.Void,
26 handler: Effect.fn("desktop.ipc.clientSettings.set")(function* (settings) {
27 const clientSettings = yield* DesktopClientSettings.DesktopClientSettings;
28 const snapShot = yield* DesktopSnapShot.DesktopSnapShot;
29 yield* clientSettings.set(settings);
30 yield* snapShot.configure(settings);
31 yield* applyLanguage(settings.language);
32 }),
33 });