Skip to content

Commit

Permalink
fixed imports
Browse files Browse the repository at this point in the history
  • Loading branch information
PolisanTheEasyNick committed Jun 1, 2024
1 parent cdbc00b commit 0157b85
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/main/keybinds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -33,7 +33,7 @@ export function initKeybinds() {
}
});

pipe.on("end", () => {
pipe.once("end", () => {
pipe.destroy();
initKeybinds();
});
Expand Down

0 comments on commit 0157b85

Please sign in to comment.