fixed imports

This commit is contained in:
Oleh Polisan 2024-06-02 00:29:15 +03:00
parent cdbc00b3e5
commit 0157b85ae1

View file

@ -4,27 +4,27 @@
* Copyright (c) 2023 Vendicated and Vencord contributors
*/
import child_process from "node:child_process";
import fs from "node:fs";
import path from "node:path";
import { spawnSync } from "node:child_process";
import { constants, open } from "node:fs";
import { join } from "node:path";
import net from "net";
import { Socket } from "net";
import { IpcEvents } from "shared/IpcEvents";
import { mainWin } from "./mainWindow";
const xdgRuntimeDir = process.env.XDG_RUNTIME_DIR || process.env.TMP || "/tmp";
const socketFile = path.join(xdgRuntimeDir, "vesktop-ipc");
const socketFile = join(xdgRuntimeDir, "vesktop-ipc");
export function initKeybinds() {
child_process.spawnSync("mkfifo", [socketFile]);
fs.open(socketFile, fs.constants.O_RDONLY | fs.constants.O_NONBLOCK, (err, fd) => {
spawnSync("mkfifo", [socketFile]);
open(socketFile, constants.O_RDONLY | constants.O_NONBLOCK, (err, fd) => {
if (err) {
console.error("Error opening pipe:", err);
return;
}
const pipe = new net.Socket({ fd });
const pipe = new Socket({ fd });
pipe.on("data", data => {
const Actions = new Set([IpcEvents.TOGGLE_SELF_DEAF, IpcEvents.TOGGLE_SELF_MUTE]);
const action = data.toString().trim();
@ -33,7 +33,7 @@ export function initKeybinds() {
}
});
pipe.on("end", () => {
pipe.once("end", () => {
pipe.destroy();
initKeybinds();
});