2023-04-09 22:49:50 +02:00
|
|
|
/*
|
|
|
|
* SPDX-License-Identifier: GPL-3.0
|
|
|
|
* Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience
|
|
|
|
* Copyright (c) 2023 Vendicated and Vencord contributors
|
|
|
|
*/
|
|
|
|
|
2023-04-09 02:26:31 +02:00
|
|
|
import type { Settings } from "shared/settings";
|
|
|
|
import type { LiteralUnion } from "type-fest";
|
2023-04-09 22:49:50 +02:00
|
|
|
|
2023-04-09 01:22:31 +02:00
|
|
|
import { IpcEvents } from "../shared/IpcEvents";
|
2023-04-10 22:53:44 +02:00
|
|
|
import { invoke, sendSync } from "./typedIpcs";
|
2023-04-09 02:26:31 +02:00
|
|
|
|
2023-04-09 01:20:00 +02:00
|
|
|
export const VencordDesktopNative = {
|
2023-04-04 01:35:37 +02:00
|
|
|
app: {
|
2023-04-09 02:26:31 +02:00
|
|
|
relaunch: () => invoke<void>(IpcEvents.RELAUNCH),
|
2023-04-09 03:06:19 +02:00
|
|
|
getVersion: () => sendSync<void>(IpcEvents.GET_VERSION)
|
2023-04-04 04:40:03 +02:00
|
|
|
},
|
2023-04-05 05:19:48 +02:00
|
|
|
fileManager: {
|
2023-04-09 02:26:31 +02:00
|
|
|
showItemInFolder: (path: string) => invoke<void>(IpcEvents.SHOW_ITEM_IN_FOLDER, path),
|
2023-04-09 22:49:50 +02:00
|
|
|
selectVencordDir: () => invoke<LiteralUnion<"cancelled" | "invalid", string>>(IpcEvents.SELECT_VENCORD_DIR)
|
2023-04-04 04:40:03 +02:00
|
|
|
},
|
|
|
|
settings: {
|
2023-04-09 02:26:31 +02:00
|
|
|
get: () => sendSync<Settings>(IpcEvents.GET_SETTINGS),
|
2023-04-10 01:43:47 +02:00
|
|
|
set: (settings: Settings, path?: string) => invoke<void>(IpcEvents.SET_SETTINGS, settings, path)
|
2023-04-05 05:19:48 +02:00
|
|
|
},
|
2023-04-14 04:05:56 +02:00
|
|
|
spellcheck: {
|
|
|
|
setLanguages: (languages: readonly string[]) => invoke<void>(IpcEvents.SPELLCHECK_SET_LANGUAGES, languages)
|
|
|
|
// todo: perhaps add ways to learn words
|
|
|
|
},
|
2023-04-05 05:19:48 +02:00
|
|
|
win: {
|
2023-04-09 02:26:31 +02:00
|
|
|
focus: () => invoke<void>(IpcEvents.FOCUS)
|
2023-04-04 01:35:37 +02:00
|
|
|
}
|
2023-04-09 22:49:50 +02:00
|
|
|
};
|